VCCC  2024.05
VisualCamp Common C++ library
resize.hpp
Go to the documentation of this file.
1 # /*
2 # * Created by YongGyu Lee on 2020/12/08.
3 # */
4 #
5 # ifndef VCCC_TYPE_RESIZE_HPP
6 # define VCCC_TYPE_RESIZE_HPP
7 #
8 # include "vccc/type_traits.hpp"
10 
11 namespace vccc {
12 
15 
16 # if VCCC_USE_OPENCV_FEATURES
26 template<int new_size, typename T, int old_size>
27 inline auto resize(const cv::Vec<T, old_size>& from)
28 {
29  return convert_to<cv::Vec<T, new_size>>(from);
30 }
31 # endif
32 
43 template<int new_size, typename T, typename = void_t<decltype(std::declval<T>().resize(new_size))>>
44 inline decltype(auto) resize(T&& t)
45 {
46  auto copy_or_same = std::forward<T>(t);
47  copy_or_same.resize(new_size);
48  return copy_or_same;
49 }
50 
52 
53 } // namespace vccc
54 
55 # endif // VCCC_TYPE_RESIZE_HPP
Definition: directory.h:12
auto resize(const cv::Point_< T > &from)
Definition: cv_point.hpp:184