Merge pull request #14827 from YashasSamaga:cuda4dnn-csl-low
[platform/upstream/opencv.git] / modules / dnn / src / cuda4dnn / cxx_utils / is_iterator.hpp
1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
4
5 #ifndef OPENCV_DNN_SRC_CUDA4DNN_CXX_UTILS_IS_ITERATOR_HPP
6 #define OPENCV_DNN_SRC_CUDA4DNN_CXX_UTILS_IS_ITERATOR_HPP
7
8 #include <iterator>
9 #include <type_traits>
10
11 namespace cv { namespace dnn { namespace cuda4dnn { namespace cxx_utils {
12
13     namespace detail {
14         template <class T, class Tag, class = void>
15         struct is_iterator_helper : std::false_type {};
16
17         template <class T, class Tag>
18         struct is_iterator_helper<T, Tag,
19                 typename std::enable_if<std::is_base_of<Tag, typename std::iterator_traits<T>::iterator_category>::value, void>::type
20             > : std::true_type {};
21     }
22
23     template <class T>
24     using is_iterator = typename detail::is_iterator_helper<T, std::input_iterator_tag>;
25
26     template <class T>
27     using is_forward_iterator = typename detail::is_iterator_helper<T, std::forward_iterator_tag>;
28
29 }}}} /* namespace cv::dnn::cuda4dnn::csl::cxx_utils */
30
31 #endif /* OPENCV_DNN_SRC_CUDA4DNN_CXX_UTILS_IS_ITERATOR_HPP */