mirror of
https://github.com/yuzu-emu/ext-boost.git
synced 2025-01-05 19:25:34 +00:00
85 lines
2.2 KiB
C++
85 lines
2.2 KiB
C++
// Copyright David Abrahams 2006. 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_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
|
|
# define BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
|
|
|
|
# include <boost/preprocessor/cat.hpp>
|
|
# include <boost/concept/detail/backward_compatibility.hpp>
|
|
|
|
# ifdef BOOST_OLD_CONCEPT_SUPPORT
|
|
# include <boost/concept/detail/has_constraints.hpp>
|
|
# include <boost/mpl/if.hpp>
|
|
# endif
|
|
|
|
// This implementation works on Comeau and GCC, all the way back to
|
|
// 2.95
|
|
namespace boost { namespace concepts {
|
|
|
|
template <class ModelFn>
|
|
struct requirement_;
|
|
|
|
namespace detail
|
|
{
|
|
template <void(*)()> struct instantiate {};
|
|
}
|
|
|
|
template <class Model>
|
|
struct requirement
|
|
{
|
|
static void failed() { ((Model*)0)->~Model(); }
|
|
};
|
|
|
|
struct failed {};
|
|
|
|
template <class Model>
|
|
struct requirement<failed ************ Model::************>
|
|
{
|
|
static void failed() { ((Model*)0)->~Model(); }
|
|
};
|
|
|
|
# ifdef BOOST_OLD_CONCEPT_SUPPORT
|
|
|
|
template <class Model>
|
|
struct constraint
|
|
{
|
|
static void failed() { ((Model*)0)->constraints(); }
|
|
};
|
|
|
|
template <class Model>
|
|
struct requirement_<void(*)(Model)>
|
|
: mpl::if_<
|
|
concepts::not_satisfied<Model>
|
|
, constraint<Model>
|
|
, requirement<failed ************ Model::************>
|
|
>::type
|
|
{};
|
|
|
|
# else
|
|
|
|
// For GCC-2.x, these can't have exactly the same name
|
|
template <class Model>
|
|
struct requirement_<void(*)(Model)>
|
|
: requirement<failed ************ Model::************>
|
|
{};
|
|
|
|
# endif
|
|
|
|
// Version check from https://svn.boost.org/trac/boost/changeset/82886
|
|
// (boost/static_assert.hpp)
|
|
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
|
|
#define BOOST_CONCEPT_UNUSED_TYPEDEF __attribute__((unused))
|
|
#else
|
|
#define BOOST_CONCEPT_UNUSED_TYPEDEF /**/
|
|
#endif
|
|
|
|
# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
|
|
typedef ::boost::concepts::detail::instantiate< \
|
|
&::boost::concepts::requirement_<ModelFnPtr>::failed> \
|
|
BOOST_PP_CAT(boost_concept_check,__LINE__) \
|
|
BOOST_CONCEPT_UNUSED_TYPEDEF
|
|
|
|
}}
|
|
|
|
#endif // BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
|