// // 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 #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 #include #include // std::swap namespace boost { namespace gil { /// \brief Concept of default construction requirement. /// \code /// auto concept DefaultConstructible /// { /// T::T(); /// }; /// \endcode /// \ingroup BasicConcepts /// template struct DefaultConstructible { void constraints() { function_requires>(); } }; /// \brief Concept of copy construction requirement. /// \code /// auto concept CopyConstructible /// { /// T::T(T); /// T::~T(); /// }; /// \endcode /// \ingroup BasicConcepts /// template struct CopyConstructible { void constraints() { function_requires>(); } }; /// \brief Concept of copy assignment requirement. /// \code /// auto concept Assignable /// { /// typename result_type; /// result_type operator=(T&, U); /// }; /// \endcode /// \ingroup BasicConcepts /// template struct Assignable { void constraints() { function_requires>(); } }; /// \brief Concept of == and != comparability requirement. /// \code /// auto concept EqualityComparable /// { /// bool operator==(T x, T y); /// bool operator!=(T x, T y) { return !(x==y); } /// }; /// \endcode /// \ingroup BasicConcepts /// template struct EqualityComparable { void constraints() { function_requires>(); } }; /// \brief Concept of swap operation requirement. /// \code /// auto concept Swappable /// { /// void swap(T&,T&); /// }; /// \endcode /// \ingroup BasicConcepts /// template struct Swappable { void constraints() { using std::swap; swap(x,y); } T x,y; }; /// \brief Concept for type regularity requirement. /// \code /// auto concept Regular /// : DefaultConstructible /// , CopyConstructible /// , EqualityComparable /// , Assignable /// , Swappable /// {}; /// \endcode /// \ingroup BasicConcepts /// template struct Regular { void constraints() { gil_function_requires< boost::DefaultConstructibleConcept>(); gil_function_requires< boost::CopyConstructibleConcept>(); gil_function_requires< boost::EqualityComparableConcept>(); // ==, != gil_function_requires< boost::AssignableConcept>(); gil_function_requires< Swappable>(); } }; /// \brief Concept for type as metafunction requirement. /// \code /// auto concept Metafunction /// { /// typename type; /// }; /// \endcode /// \ingroup BasicConcepts /// template struct Metafunction { void constraints() { using type = typename T::type; } }; /// \brief Concept of types equivalence requirement. /// \code /// auto concept SameType; // unspecified /// \endcode /// \ingroup BasicConcepts /// template struct SameType { void constraints() { static_assert(std::is_same::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