2 // Copyright 2005-2007 Adobe Systems Incorporated
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
8 #ifndef BOOST_GIL_CONCEPTS_BASIC_HPP
9 #define BOOST_GIL_CONCEPTS_BASIC_HPP
11 #include <boost/config.hpp>
13 #if defined(BOOST_CLANG)
14 #pragma clang diagnostic push
15 #pragma clang diagnostic ignored "-Wunused-local-typedefs"
16 #pragma clang diagnostic ignored "-Wuninitialized"
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"
25 #include <boost/gil/concepts/concept_check.hpp>
27 #include <type_traits>
28 #include <utility> // std::swap
30 namespace boost { namespace gil {
32 /// \brief Concept of default construction requirement.
34 /// auto concept DefaultConstructible<typename T>
39 /// \ingroup BasicConcepts
42 struct DefaultConstructible
46 function_requires<boost::DefaultConstructibleConcept<T>>();
50 /// \brief Concept of copy construction requirement.
52 /// auto concept CopyConstructible<typename T>
58 /// \ingroup BasicConcepts
61 struct CopyConstructible
65 function_requires<boost::CopyConstructibleConcept<T>>();
69 /// \brief Concept of copy assignment requirement.
71 /// auto concept Assignable<typename T, typename U = T>
73 /// typename result_type;
74 /// result_type operator=(T&, U);
77 /// \ingroup BasicConcepts
84 function_requires<boost::AssignableConcept<T>>();
88 /// \brief Concept of == and != comparability requirement.
90 /// auto concept EqualityComparable<typename T, typename U = T>
92 /// bool operator==(T x, T y);
93 /// bool operator!=(T x, T y) { return !(x==y); }
96 /// \ingroup BasicConcepts
99 struct EqualityComparable
103 function_requires<boost::EqualityComparableConcept<T>>();
107 /// \brief Concept of swap operation requirement.
109 /// auto concept Swappable<typename T>
111 /// void swap(T&,T&);
114 /// \ingroup BasicConcepts
116 template <typename T>
127 /// \brief Concept for type regularity requirement.
129 /// auto concept Regular<typename T>
130 /// : DefaultConstructible<T>
131 /// , CopyConstructible<T>
132 /// , EqualityComparable<T>
137 /// \ingroup BasicConcepts
139 template <typename T>
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>>();
152 /// \brief Concept for type as metafunction requirement.
154 /// auto concept Metafunction<typename T>
159 /// \ingroup BasicConcepts
161 template <typename T>
166 using type = typename T::type;
170 /// \brief Concept of types equivalence requirement.
172 /// auto concept SameType<typename T, typename U>; // unspecified
174 /// \ingroup BasicConcepts
176 template <typename T, typename U>
181 static_assert(std::is_same<T, U>::value, "");
185 }} // namespace boost::gil
187 #if defined(BOOST_CLANG)
188 #pragma clang diagnostic pop
191 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
192 #pragma GCC diagnostic pop