| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 | 
							- //
 
- // Copyright 2005-2007 Adobe Systems Incorporated
 
- //
 
- // Distributed under the Boost Software License, Version 1.0
 
- // See accompanying file LICENSE_1_0.txt or copy at
 
- // http://www.boost.org/LICENSE_1_0.txt
 
- //
 
- #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 {
 
- /// \brief Concept of default construction requirement.
 
- /// \code
 
- /// auto concept DefaultConstructible<typename T>
 
- /// {
 
- ///     T::T();
 
- /// };
 
- /// \endcode
 
- /// \ingroup BasicConcepts
 
- ///
 
- template <typename T>
 
- struct DefaultConstructible
 
- {
 
-     void constraints()
 
-     {
 
-         function_requires<boost::DefaultConstructibleConcept<T>>();
 
-     }
 
- };
 
- /// \brief Concept of copy construction requirement.
 
- /// \code
 
- /// auto concept CopyConstructible<typename T>
 
- /// {
 
- ///     T::T(T);
 
- ///     T::~T();
 
- /// };
 
- /// \endcode
 
- /// \ingroup BasicConcepts
 
- ///
 
- template <typename T>
 
- struct CopyConstructible
 
- {
 
-     void constraints()
 
-     {
 
-         function_requires<boost::CopyConstructibleConcept<T>>();
 
-     }
 
- };
 
- /// \brief Concept of copy assignment requirement.
 
- /// \code
 
- /// auto concept Assignable<typename T, typename U = T>
 
- /// {
 
- ///     typename result_type;
 
- ///     result_type operator=(T&, U);
 
- /// };
 
- /// \endcode
 
- /// \ingroup BasicConcepts
 
- ///
 
- template <typename T>
 
- struct Assignable
 
- {
 
-     void constraints()
 
-     {
 
-         function_requires<boost::AssignableConcept<T>>();
 
-     }
 
- };
 
- /// \brief Concept of == and != comparability requirement.
 
- /// \code
 
- /// auto concept EqualityComparable<typename T, typename U = T>
 
- /// {
 
- ///     bool operator==(T x, T y);
 
- ///     bool operator!=(T x, T y) { return !(x==y); }
 
- /// };
 
- /// \endcode
 
- /// \ingroup BasicConcepts
 
- ///
 
- template <typename T>
 
- struct EqualityComparable
 
- {
 
-     void constraints()
 
-     {
 
-         function_requires<boost::EqualityComparableConcept<T>>();
 
-     }
 
- };
 
- /// \brief Concept of swap operation requirement.
 
- /// \code
 
- /// auto concept Swappable<typename T>
 
- /// {
 
- ///     void swap(T&,T&);
 
- /// };
 
- /// \endcode
 
- /// \ingroup BasicConcepts
 
- ///
 
- template <typename T>
 
- struct Swappable
 
- {
 
-     void constraints()
 
-     {
 
-         using std::swap;
 
-         swap(x,y);
 
-     }
 
-     T x,y;
 
- };
 
- /// \brief Concept for type regularity requirement.
 
- /// \code
 
- /// auto concept Regular<typename T>
 
- ///     : DefaultConstructible<T>
 
- ///     , CopyConstructible<T>
 
- ///     , EqualityComparable<T>
 
- ///     , Assignable<T>
 
- ///     , Swappable<T>
 
- /// {};
 
- /// \endcode
 
- /// \ingroup BasicConcepts
 
- ///
 
- 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>>();
 
-     }
 
- };
 
- /// \brief Concept for type as metafunction requirement.
 
- /// \code
 
- /// auto concept Metafunction<typename T>
 
- /// {
 
- ///     typename type;
 
- /// };
 
- /// \endcode
 
- /// \ingroup BasicConcepts
 
- ///
 
- template <typename T>
 
- struct Metafunction
 
- {
 
-     void constraints()
 
-     {
 
-         using type = typename T::type;
 
-     }
 
- };
 
- /// \brief Concept of types equivalence requirement.
 
- /// \code
 
- /// auto concept SameType<typename T, typename U>; // unspecified
 
- /// \endcode
 
- /// \ingroup BasicConcepts
 
- ///
 
- template <typename T, typename U>
 
- struct SameType
 
- {
 
-     void constraints()
 
-     {
 
-         static_assert(std::is_same<T, U>::value, "");
 
-     }
 
- };
 
- }} // namespace boost::gil
 
- #if defined(BOOST_CLANG)
 
- #pragma clang diagnostic pop
 
- #endif
 
- #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
 
- #pragma GCC diagnostic pop
 
- #endif
 
- #endif
 
 
  |