PMDK C++ bindings  1.13.0-git107.g7e59f08f
This is the C++ bindings documentation for PMDK's libpmemobj.
iterator_traits.hpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: BSD-3-Clause
2 /* Copyright 2018, Intel Corporation */
3 
9 #ifndef LIBPMEMOBJ_CPP_ITERATOR_TRAITS_HPP
10 #define LIBPMEMOBJ_CPP_ITERATOR_TRAITS_HPP
11 
12 #include <iterator>
13 
14 namespace pmem
15 {
16 
17 namespace detail
18 {
19 
20 template <typename T, typename U, typename C = void>
21 struct has_iterator_category_convertible_to : std::false_type {
22 };
23 
24 template <typename T, typename U>
25 struct has_iterator_category_convertible_to<
26  T, U,
27  typename std::enable_if<std::is_convertible<
28  typename std::iterator_traits<T>::iterator_category,
29  U>::value>::type> : std::true_type {
30 };
31 
36 template <typename T>
38  : public has_iterator_category_convertible_to<T, std::output_iterator_tag> {
39 };
40 
45 template <typename T>
47  : public has_iterator_category_convertible_to<T, std::input_iterator_tag> {
48 };
49 
54 template <typename T>
56  : public has_iterator_category_convertible_to<T,
57  std::forward_iterator_tag> {
58 };
59 
64 template <typename T>
65 struct is_bidirectional_iterator : public has_iterator_category_convertible_to<
66  T, std::bidirectional_iterator_tag> {
67 };
68 
73 template <typename T>
74 struct is_random_access_iterator : public has_iterator_category_convertible_to<
75  T, std::random_access_iterator_tag> {
76 };
77 
78 } /* namespace detail */
79 
80 } /* namespace pmem */
81 
82 #endif /* LIBPMEMOBJ_CPP_ITERATOR_TRAITS_HPP */
Persistent memory namespace.
Definition: allocation_flag.hpp:15
Type trait to determine if a given parameter type satisfies requirements of BidirectionalIterator.
Definition: iterator_traits.hpp:66
Type trait to determine if a given parameter type satisfies requirements of ForwardIterator.
Definition: iterator_traits.hpp:57
Type trait to determine if a given parameter type satisfies requirements of InputIterator.
Definition: iterator_traits.hpp:47
Type trait to determine if a given parameter type satisfies requirements of OutputIterator.
Definition: iterator_traits.hpp:38
Type trait to determine if a given parameter type satisfies requirements of RandomAccessIterator.
Definition: iterator_traits.hpp:75