123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- #ifndef BOOST_GIL_CONCEPTS_BASIC_HPP
- #define BOOST_GIL_CONCEPTS_BASIC_HPP
- #include <boost/config.hpp>
- #if defined(BOOST_CLANG)
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Wunknown-pragmas"
- #pragma clang diagnostic ignored "-Wunused-local-typedefs"
- #pragma clang diagnostic ignored "-Wuninitialized"
- #endif
- #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
- #pragma GCC diagnostic ignored "-Wuninitialized"
- #endif
- #include <boost/gil/concepts/concept_check.hpp>
- #include <type_traits>
- #include <utility> // std::swap
- namespace boost { namespace gil {
- template <typename T>
- struct DefaultConstructible
- {
- void constraints()
- {
- function_requires<boost::DefaultConstructibleConcept<T>>();
- }
- };
- template <typename T>
- struct CopyConstructible
- {
- void constraints()
- {
- function_requires<boost::CopyConstructibleConcept<T>>();
- }
- };
- template <typename T>
- struct Assignable
- {
- void constraints()
- {
- function_requires<boost::AssignableConcept<T>>();
- }
- };
- template <typename T>
- struct EqualityComparable
- {
- void constraints()
- {
- function_requires<boost::EqualityComparableConcept<T>>();
- }
- };
- template <typename T>
- struct Swappable
- {
- void constraints()
- {
- using std::swap;
- swap(x,y);
- }
- T x,y;
- };
- template <typename T>
- struct Regular
- {
- void constraints()
- {
- gil_function_requires< boost::DefaultConstructibleConcept<T>>();
- gil_function_requires< boost::CopyConstructibleConcept<T>>();
- gil_function_requires< boost::EqualityComparableConcept<T>>();
- gil_function_requires< boost::AssignableConcept<T>>();
- gil_function_requires< Swappable<T>>();
- }
- };
- template <typename T>
- struct Metafunction
- {
- void constraints()
- {
- using type = typename T::type;
- }
- };
- template <typename T, typename U>
- struct SameType
- {
- void constraints()
- {
- static_assert(std::is_same<T, U>::value, "");
- }
- };
- }}
- #if defined(BOOST_CLANG)
- #pragma clang diagnostic pop
- #endif
- #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
- #pragma GCC diagnostic pop
- #endif
- #endif
|