File indexing completed on 2025-01-18 09:36:54
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_GIL_CONCEPTS_BASIC_HPP
0009 #define BOOST_GIL_CONCEPTS_BASIC_HPP
0010
0011 #include <boost/config.hpp>
0012
0013 #if defined(BOOST_CLANG)
0014 #pragma clang diagnostic push
0015 #pragma clang diagnostic ignored "-Wunknown-pragmas"
0016 #pragma clang diagnostic ignored "-Wunused-local-typedefs"
0017 #pragma clang diagnostic ignored "-Wuninitialized"
0018 #endif
0019
0020 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
0021 #pragma GCC diagnostic push
0022 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
0023 #pragma GCC diagnostic ignored "-Wuninitialized"
0024 #endif
0025
0026 #include <boost/gil/concepts/concept_check.hpp>
0027
0028 #include <type_traits>
0029 #include <utility> // std::swap
0030
0031 namespace boost { namespace gil {
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 template <typename T>
0043 struct DefaultConstructible
0044 {
0045 void constraints()
0046 {
0047 function_requires<boost::DefaultConstructibleConcept<T>>();
0048 }
0049 };
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 template <typename T>
0062 struct CopyConstructible
0063 {
0064 void constraints()
0065 {
0066 function_requires<boost::CopyConstructibleConcept<T>>();
0067 }
0068 };
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080 template <typename T>
0081 struct Assignable
0082 {
0083 void constraints()
0084 {
0085 function_requires<boost::AssignableConcept<T>>();
0086 }
0087 };
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099 template <typename T>
0100 struct EqualityComparable
0101 {
0102 void constraints()
0103 {
0104 function_requires<boost::EqualityComparableConcept<T>>();
0105 }
0106 };
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117 template <typename T>
0118 struct Swappable
0119 {
0120 void constraints()
0121 {
0122 using std::swap;
0123 swap(x,y);
0124 }
0125 T x,y;
0126 };
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140 template <typename T>
0141 struct Regular
0142 {
0143 void constraints()
0144 {
0145 gil_function_requires< boost::DefaultConstructibleConcept<T>>();
0146 gil_function_requires< boost::CopyConstructibleConcept<T>>();
0147 gil_function_requires< boost::EqualityComparableConcept<T>>();
0148 gil_function_requires< boost::AssignableConcept<T>>();
0149 gil_function_requires< Swappable<T>>();
0150 }
0151 };
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162 template <typename T>
0163 struct Metafunction
0164 {
0165 void constraints()
0166 {
0167 using type = typename T::type;
0168 }
0169 };
0170
0171
0172
0173
0174
0175
0176
0177 template <typename T, typename U>
0178 struct SameType
0179 {
0180 void constraints()
0181 {
0182 static_assert(std::is_same<T, U>::value, "");
0183 }
0184 };
0185
0186 }}
0187
0188 #if defined(BOOST_CLANG)
0189 #pragma clang diagnostic pop
0190 #endif
0191
0192 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
0193 #pragma GCC diagnostic pop
0194 #endif
0195
0196 #endif