Boost GIL


basic.hpp
1 //
2 // Copyright 2005-2007 Adobe Systems Incorporated
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_CONCEPTS_BASIC_HPP
9 #define BOOST_GIL_CONCEPTS_BASIC_HPP
10 
11 #include <boost/config.hpp>
12 
13 #if defined(BOOST_CLANG)
14 #pragma clang diagnostic push
15 #pragma clang diagnostic ignored "-Wunused-local-typedefs"
16 #pragma clang diagnostic ignored "-Wuninitialized"
17 #endif
18 
19 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
20 #pragma GCC diagnostic push
21 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
22 #pragma GCC diagnostic ignored "-Wuninitialized"
23 #endif
24 
25 #include <boost/gil/concepts/concept_check.hpp>
26 
27 #include <type_traits>
28 #include <utility> // std::swap
29 
30 namespace boost { namespace gil {
31 
41 template <typename T>
43 {
44  void constraints()
45  {
46  function_requires<boost::DefaultConstructibleConcept<T>>();
47  }
48 };
49 
60 template <typename T>
62 {
63  void constraints()
64  {
65  function_requires<boost::CopyConstructibleConcept<T>>();
66  }
67 };
68 
79 template <typename T>
80 struct Assignable
81 {
82  void constraints()
83  {
84  function_requires<boost::AssignableConcept<T>>();
85  }
86 };
87 
98 template <typename T>
100 {
101  void constraints()
102  {
103  function_requires<boost::EqualityComparableConcept<T>>();
104  }
105 };
106 
116 template <typename T>
117 struct Swappable
118 {
119  void constraints()
120  {
121  using std::swap;
122  swap(x,y);
123  }
124  T x,y;
125 };
126 
139 template <typename T>
140 struct Regular
141 {
142  void constraints()
143  {
144  gil_function_requires< boost::DefaultConstructibleConcept<T>>();
145  gil_function_requires< boost::CopyConstructibleConcept<T>>();
146  gil_function_requires< boost::EqualityComparableConcept<T>>(); // ==, !=
147  gil_function_requires< boost::AssignableConcept<T>>();
148  gil_function_requires< Swappable<T>>();
149  }
150 };
151 
161 template <typename T>
163 {
164  void constraints()
165  {
166  using type = typename T::type;
167  }
168 };
169 
176 template <typename T, typename U>
177 struct SameType
178 {
179  void constraints()
180  {
181  static_assert(std::is_same<T, U>::value, "");
182  }
183 };
184 
185 }} // namespace boost::gil
186 
187 #if defined(BOOST_CLANG)
188 #pragma clang diagnostic pop
189 #endif
190 
191 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
192 #pragma GCC diagnostic pop
193 #endif
194 
195 #endif
Concept of == and != comparability requirement.
Definition: basic.hpp:99
Concept of types equivalence requirement.
Definition: basic.hpp:177
Concept of copy construction requirement.
Definition: basic.hpp:61
Concept of swap operation requirement.
Definition: basic.hpp:117
Concept of default construction requirement.
Definition: basic.hpp:42
Concept for type as metafunction requirement.
Definition: basic.hpp:162
Concept of copy assignment requirement.
Definition: basic.hpp:80
void swap(boost::gil::packed_channel_reference< BF, FB, NB, M > const x, R &y)
swap for packed_channel_reference
Definition: channel.hpp:529
Concept for type regularity requirement.
Definition: basic.hpp:140