PMDK C++ bindings  1.7
This is the C++ bindings documentation for PMDK's libpmemobj.
iterator_traits.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018, Intel Corporation
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  *
16  * * Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
38 #ifndef LIBPMEMOBJ_CPP_ITERATOR_TRAITS_HPP
39 #define LIBPMEMOBJ_CPP_ITERATOR_TRAITS_HPP
40 
41 #include <iterator>
42 
43 namespace pmem
44 {
45 
46 namespace detail
47 {
48 
49 template <typename T, typename U, typename C = void>
50 struct has_iterator_category_convertible_to : std::false_type {
51 };
52 
53 template <typename T, typename U>
54 struct has_iterator_category_convertible_to<
55  T, U,
56  typename std::enable_if<std::is_convertible<
57  typename std::iterator_traits<T>::iterator_category,
58  U>::value>::type> : std::true_type {
59 };
60 
65 template <typename T>
67  : public has_iterator_category_convertible_to<T, std::output_iterator_tag> {
68 };
69 
74 template <typename T>
76  : public has_iterator_category_convertible_to<T, std::input_iterator_tag> {
77 };
78 
83 template <typename T>
85  : public has_iterator_category_convertible_to<T,
86  std::forward_iterator_tag> {
87 };
88 
93 template <typename T>
94 struct is_bidirectional_iterator : public has_iterator_category_convertible_to<
95  T, std::bidirectional_iterator_tag> {
96 };
97 
102 template <typename T>
103 struct is_random_access_iterator : public has_iterator_category_convertible_to<
104  T, std::random_access_iterator_tag> {
105 };
106 
107 } /* namespace detail */
108 
109 } /* namespace pmem */
110 
111 #endif /* LIBPMEMOBJ_CPP_ITERATOR_TRAITS_HPP */
pmem::detail::is_bidirectional_iterator
Type trait to determine if a given parameter type satisfies requirements of BidirectionalIterator.
Definition: iterator_traits.hpp:95
pmem::detail::is_forward_iterator
Type trait to determine if a given parameter type satisfies requirements of ForwardIterator.
Definition: iterator_traits.hpp:86
pmem::detail::is_input_iterator
Type trait to determine if a given parameter type satisfies requirements of InputIterator.
Definition: iterator_traits.hpp:76
std
A persistent version of concurrent hash map implementation Ref: https://arxiv.org/abs/1509....
Definition: concurrent_hash_map.hpp:75
pmem::detail::is_output_iterator
Type trait to determine if a given parameter type satisfies requirements of OutputIterator.
Definition: iterator_traits.hpp:67
pmem::detail::is_random_access_iterator
Type trait to determine if a given parameter type satisfies requirements of RandomAccessIterator.
Definition: iterator_traits.hpp:104