1
0
mirror of https://git.suyu.dev/suyu/suyu synced 2025-09-10 00:06:32 -05:00

Initial commit

This commit is contained in:
Crimson-Hawk
2024-03-05 16:42:40 +08:00
commit f1e4595ebf
39576 changed files with 7006612 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
// 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_ASSERT_DWA2006430_HPP
# define BOOST_CONCEPT_ASSERT_DWA2006430_HPP
# include <boost/config.hpp>
# include <boost/config/workaround.hpp>
// The old protocol used a constraints() member function in concept
// checking classes. If the compiler supports SFINAE, we can detect
// that function and seamlessly support the old concept checking
// classes. In this release, backward compatibility with the old
// concept checking classes is enabled by default, where available.
// The old protocol is deprecated, though, and backward compatibility
// will no longer be the default in the next release.
# if !defined(BOOST_NO_OLD_CONCEPT_SUPPORT) \
&& !defined(BOOST_NO_SFINAE) \
\
&& !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4))
// Note: gcc-2.96 through 3.3.x have some SFINAE, but no ability to
// check for the presence of particularmember functions.
# define BOOST_OLD_CONCEPT_SUPPORT
# endif
# ifdef BOOST_MSVC
# include <boost/concept/detail/msvc.hpp>
# elif BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
# include <boost/concept/detail/borland.hpp>
# else
# include <boost/concept/detail/general.hpp>
# endif
// Usage, in class or function context:
//
// BOOST_CONCEPT_ASSERT((UnaryFunctionConcept<F,bool,int>));
//
# define BOOST_CONCEPT_ASSERT(ModelInParens) \
BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
#endif // BOOST_CONCEPT_ASSERT_DWA2006430_HPP

View File

@@ -0,0 +1,16 @@
// Copyright David Abrahams 2009. 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_BACKWARD_COMPATIBILITY_DWA200968_HPP
# define BOOST_CONCEPT_BACKWARD_COMPATIBILITY_DWA200968_HPP
namespace boost
{
namespace concepts {}
# if defined(BOOST_HAS_CONCEPTS) && !defined(BOOST_CONCEPT_NO_BACKWARD_KEYWORD)
namespace concept = concepts;
# endif
} // namespace boost::concept
#endif // BOOST_CONCEPT_BACKWARD_COMPATIBILITY_DWA200968_HPP

View File

@@ -0,0 +1,30 @@
// 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_BORLAND_DWA2006429_HPP
# define BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP
# include <boost/preprocessor/cat.hpp>
# include <boost/concept/detail/backward_compatibility.hpp>
namespace boost { namespace concepts {
template <class ModelFnPtr>
struct require;
template <class Model>
struct require<void(*)(Model)>
{
enum { instantiate = sizeof((((Model*)0)->~Model()), 3) };
};
# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
enum \
{ \
BOOST_PP_CAT(boost_concept_check,__LINE__) = \
boost::concepts::require<ModelFnPtr>::instantiate \
}
}} // namespace boost::concept
#endif // BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP

View File

@@ -0,0 +1,34 @@
// 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_CONCEPT_DEF_DWA200651_HPP
# define BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP
# include <boost/preprocessor/seq/for_each_i.hpp>
# include <boost/preprocessor/seq/enum.hpp>
# include <boost/preprocessor/comma_if.hpp>
# include <boost/preprocessor/cat.hpp>
#endif // BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP
// BOOST_concept(SomeName, (p1)(p2)...(pN))
//
// Expands to "template <class p1, class p2, ...class pN> struct SomeName"
//
// Also defines an equivalent SomeNameConcept for backward compatibility.
// Maybe in the next release we can kill off the "Concept" suffix for good.
# define BOOST_concept(name, params) \
template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \
struct name; /* forward declaration */ \
\
template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \
struct BOOST_PP_CAT(name,Concept) \
: name< BOOST_PP_SEQ_ENUM(params) > \
{ \
}; \
\
template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \
struct name
// Helper for BOOST_concept, above.
# define BOOST_CONCEPT_typename(r, ignored, index, t) \
BOOST_PP_COMMA_IF(index) typename t

View File

@@ -0,0 +1,5 @@
// 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)
# undef BOOST_concept_typename
# undef BOOST_concept

View File

@@ -0,0 +1,98 @@
// 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/config.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/type_traits/conditional.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
{
# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wnonnull"
# endif
static void failed() { ((Model*)0)->~Model(); }
# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
# pragma GCC diagnostic pop
# endif
};
struct failed {};
template <class Model>
struct requirement<failed ************ Model::************>
{
# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wnonnull"
# endif
static void failed() { ((Model*)0)->~Model(); }
# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
# pragma GCC diagnostic pop
# endif
};
# ifdef BOOST_OLD_CONCEPT_SUPPORT
template <class Model>
struct constraint
{
# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wnonnull"
# endif
static void failed() { ((Model*)0)->constraints(); }
# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
# pragma GCC diagnostic pop
# endif
};
template <class Model>
struct requirement_<void(*)(Model)>
: boost::conditional<
concepts::not_satisfied<Model>::value
, 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
# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
typedef ::boost::concepts::detail::instantiate< \
&::boost::concepts::requirement_<ModelFnPtr>::failed> \
BOOST_PP_CAT(boost_concept_check,__LINE__) \
BOOST_ATTRIBUTE_UNUSED
}}
#endif // BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP

View File

@@ -0,0 +1,50 @@
// 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_HAS_CONSTRAINTS_DWA2006429_HPP
# define BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP
# include <boost/type_traits/integral_constant.hpp>
# include <boost/config/workaround.hpp>
# include <boost/concept/detail/backward_compatibility.hpp>
namespace boost { namespace concepts {
namespace detail
{
// Here we implement the metafunction that detects whether a
// constraints metafunction exists
typedef char yes;
typedef char (&no)[2];
template <class Model, void (Model::*)()>
struct wrap_constraints {};
#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580) || defined(__CUDACC__)
// Work around the following bogus error in Sun Studio 11, by
// turning off the has_constraints function entirely:
// Error: complex expression not allowed in dependent template
// argument expression
inline no has_constraints_(...);
#else
template <class Model>
inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
inline no has_constraints_(...);
#endif
}
// This would be called "detail::has_constraints," but it has a strong
// tendency to show up in error messages.
template <class Model>
struct not_satisfied
{
BOOST_STATIC_CONSTANT(
bool
, value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) );
typedef boost::integral_constant<bool, value> type;
};
}} // namespace boost::concepts::detail
#endif // BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP

View File

@@ -0,0 +1,123 @@
// 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_CHECK_MSVC_DWA2006429_HPP
# define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
# include <boost/preprocessor/cat.hpp>
# include <boost/concept/detail/backward_compatibility.hpp>
# include <boost/config.hpp>
# ifdef BOOST_OLD_CONCEPT_SUPPORT
# include <boost/concept/detail/has_constraints.hpp>
# include <boost/type_traits/conditional.hpp>
# endif
# ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable:4100)
# endif
namespace boost { namespace concepts {
template <class Model>
struct check
{
virtual void failed(Model* x)
{
x->~Model();
}
};
# ifndef BOOST_NO_PARTIAL_SPECIALIZATION
struct failed {};
template <class Model>
struct check<failed ************ Model::************>
{
virtual void failed(Model* x)
{
x->~Model();
}
};
# endif
# ifdef BOOST_OLD_CONCEPT_SUPPORT
namespace detail
{
// No need for a virtual function here, since evaluating
// not_satisfied below will have already instantiated the
// constraints() member.
struct constraint {};
}
template <class Model>
struct require
: boost::conditional<
not_satisfied<Model>::value
, detail::constraint
# ifndef BOOST_NO_PARTIAL_SPECIALIZATION
, check<Model>
# else
, check<failed ************ Model::************>
# endif
>::type
{};
# else
template <class Model>
struct require
# ifndef BOOST_NO_PARTIAL_SPECIALIZATION
: check<Model>
# else
: check<failed ************ Model::************>
# endif
{};
# endif
# if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
//
// The iterator library sees some really strange errors unless we
// do things this way.
//
template <class Model>
struct require<void(*)(Model)>
{
virtual void failed(Model*)
{
require<Model>();
}
};
# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
enum \
{ \
BOOST_PP_CAT(boost_concept_check,__LINE__) = \
sizeof(::boost::concepts::require<ModelFnPtr>) \
}
# else // Not vc-7.1
template <class Model>
require<Model>
require_(void(*)(Model));
# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
enum \
{ \
BOOST_PP_CAT(boost_concept_check,__LINE__) = \
sizeof(::boost::concepts::require_((ModelFnPtr)0)) \
}
# endif
}}
# ifdef BOOST_MSVC
# pragma warning(pop)
# endif
#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP

View File

@@ -0,0 +1,93 @@
// 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_REQUIRES_DWA2006430_HPP
# define BOOST_CONCEPT_REQUIRES_DWA2006430_HPP
# include <boost/config.hpp>
# include <boost/concept/assert.hpp>
# include <boost/preprocessor/seq/for_each.hpp>
namespace boost {
// unaryfunptr_arg_type from parameter/aux_/parenthesized_type.hpp
namespace ccheck_aux {
// A metafunction that transforms void(*)(T) -> T
template <class UnaryFunctionPointer>
struct unaryfunptr_arg_type;
template <class Arg>
struct unaryfunptr_arg_type<void(*)(Arg)>
{
typedef Arg type;
};
template <>
struct unaryfunptr_arg_type<void(*)(void)>
{
typedef void type;
};
} // namespace ccheck_aux
// Template for use in handwritten assertions
template <class Model, class More>
struct requires_ : More
{
BOOST_CONCEPT_ASSERT((Model));
};
// Template for use by macros, where models must be wrapped in parens.
// This isn't in namespace detail to keep extra cruft out of resulting
// error messages.
template <class ModelFn>
struct _requires_
{
enum { value = 0 };
BOOST_CONCEPT_ASSERT_FN(ModelFn);
};
template <int check, class Result>
struct Requires_ : ::boost::ccheck_aux::unaryfunptr_arg_type<Result>
{
};
# if BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(1010))
# define BOOST_CONCEPT_REQUIRES_(r,data,t) | (::boost::_requires_<void(*)t>::value)
# else
# define BOOST_CONCEPT_REQUIRES_(r,data,t) + (::boost::_requires_<void(*)t>::value)
# endif
#if defined(NDEBUG)
# define BOOST_CONCEPT_REQUIRES(models, result) \
typename ::boost::ccheck_aux::unaryfunptr_arg_type<void(*)result>::type
#elif BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
// Same thing as below without the initial typename
# define BOOST_CONCEPT_REQUIRES(models, result) \
::boost::Requires_< \
(0 BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_REQUIRES_, ~, models)), \
::boost::ccheck_aux::unaryfunptr_arg_type<void(*)result> \
>::type
#else
// This just ICEs on MSVC6 :(
# define BOOST_CONCEPT_REQUIRES(models, result) \
typename ::boost::Requires_< \
(0 BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_REQUIRES_, ~, models)), \
void(*)result \
>::type
#endif
// C++0x proposed syntax changed. This supports an older usage
#define BOOST_CONCEPT_WHERE(models,result) BOOST_CONCEPT_REQUIRES(models,result)
} // namespace boost::concept_check
#endif // BOOST_CONCEPT_REQUIRES_DWA2006430_HPP

View File

@@ -0,0 +1,43 @@
// 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_USAGE_DWA2006919_HPP
# define BOOST_CONCEPT_USAGE_DWA2006919_HPP
# include <boost/concept/assert.hpp>
# include <boost/config/workaround.hpp>
# include <boost/concept/detail/backward_compatibility.hpp>
namespace boost { namespace concepts {
template <class Model>
struct usage_requirements
{
# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wnonnull"
# endif
~usage_requirements() { ((Model*)0)->~Model(); }
# if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
# pragma GCC diagnostic pop
# endif
};
# if BOOST_WORKAROUND(__GNUC__, <= 3)
# define BOOST_CONCEPT_USAGE(model) \
model(); /* at least 2.96 and 3.4.3 both need this :( */ \
BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements<model>)); \
~model()
# else
# define BOOST_CONCEPT_USAGE(model) \
BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements<model>)); \
~model()
# endif
}} // namespace boost::concepts
#endif // BOOST_CONCEPT_USAGE_DWA2006919_HPP

View File

@@ -0,0 +1,670 @@
//
// (C) Copyright Jeremy Siek 2000.
// 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)
//
// Revision History:
//
// 17 July 2001: Added const to some member functions. (Jeremy Siek)
// 05 May 2001: Removed static dummy_cons object. (Jeremy Siek)
// See http://www.boost.org/libs/concept_check for documentation.
#ifndef BOOST_CONCEPT_ARCHETYPES_HPP
#define BOOST_CONCEPT_ARCHETYPES_HPP
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <functional>
#include <iterator> // iterator tags
#include <cstddef> // std::ptrdiff_t
namespace boost {
//===========================================================================
// Basic Archetype Classes
namespace detail {
class dummy_constructor { };
}
// A type that models no concept. The template parameter
// is only there so that null_archetype types can be created
// that have different type.
template <class T = int>
class null_archetype {
private:
null_archetype() { }
null_archetype(const null_archetype&) { }
null_archetype& operator=(const null_archetype&) { return *this; }
public:
null_archetype(detail::dummy_constructor) { }
#ifndef __MWERKS__
template <class TT>
friend void dummy_friend(); // just to avoid warnings
#endif
};
// This is a helper class that provides a way to get a reference to
// an object. The get() function will never be called at run-time
// (nothing in this file will) so this seemingly very bad function
// is really quite innocent. The name of this class needs to be
// changed.
template <class T>
class static_object
{
public:
static T& get()
{
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
return *reinterpret_cast<T*>(0);
#else
static char d[sizeof(T)];
return *reinterpret_cast<T*>(d);
#endif
}
};
template <class Base = null_archetype<> >
class default_constructible_archetype : public Base {
public:
default_constructible_archetype()
: Base(static_object<detail::dummy_constructor>::get()) { }
default_constructible_archetype(detail::dummy_constructor x) : Base(x) { }
};
template <class Base = null_archetype<> >
class assignable_archetype : public Base {
assignable_archetype() { }
assignable_archetype(const assignable_archetype&) { }
public:
assignable_archetype& operator=(const assignable_archetype&) {
return *this;
}
assignable_archetype(detail::dummy_constructor x) : Base(x) { }
};
template <class Base = null_archetype<> >
class copy_constructible_archetype : public Base {
public:
copy_constructible_archetype()
: Base(static_object<detail::dummy_constructor>::get()) { }
copy_constructible_archetype(const copy_constructible_archetype&)
: Base(static_object<detail::dummy_constructor>::get()) { }
copy_constructible_archetype(detail::dummy_constructor x) : Base(x) { }
};
template <class Base = null_archetype<> >
class sgi_assignable_archetype : public Base {
public:
sgi_assignable_archetype(const sgi_assignable_archetype&)
: Base(static_object<detail::dummy_constructor>::get()) { }
sgi_assignable_archetype& operator=(const sgi_assignable_archetype&) {
return *this;
}
sgi_assignable_archetype(const detail::dummy_constructor& x) : Base(x) { }
};
struct default_archetype_base {
default_archetype_base(detail::dummy_constructor) { }
};
// Careful, don't use same type for T and Base. That results in the
// conversion operator being invalid. Since T is often
// null_archetype, can't use null_archetype for Base.
template <class T, class Base = default_archetype_base>
class convertible_to_archetype : public Base {
private:
convertible_to_archetype() { }
convertible_to_archetype(const convertible_to_archetype& ) { }
convertible_to_archetype& operator=(const convertible_to_archetype&)
{ return *this; }
public:
convertible_to_archetype(detail::dummy_constructor x) : Base(x) { }
operator const T&() const { return static_object<T>::get(); }
};
template <class T, class Base = default_archetype_base>
class convertible_from_archetype : public Base {
private:
convertible_from_archetype() { }
convertible_from_archetype(const convertible_from_archetype& ) { }
convertible_from_archetype& operator=(const convertible_from_archetype&)
{ return *this; }
public:
convertible_from_archetype(detail::dummy_constructor x) : Base(x) { }
convertible_from_archetype(const T&) { }
convertible_from_archetype& operator=(const T&)
{ return *this; }
};
class boolean_archetype {
public:
boolean_archetype(const boolean_archetype&) { }
operator bool() const { return true; }
boolean_archetype(detail::dummy_constructor) { }
private:
boolean_archetype() { }
boolean_archetype& operator=(const boolean_archetype&) { return *this; }
};
template <class Base = null_archetype<> >
class equality_comparable_archetype : public Base {
public:
equality_comparable_archetype(detail::dummy_constructor x) : Base(x) { }
};
template <class Base>
boolean_archetype
operator==(const equality_comparable_archetype<Base>&,
const equality_comparable_archetype<Base>&)
{
return boolean_archetype(static_object<detail::dummy_constructor>::get());
}
template <class Base>
boolean_archetype
operator!=(const equality_comparable_archetype<Base>&,
const equality_comparable_archetype<Base>&)
{
return boolean_archetype(static_object<detail::dummy_constructor>::get());
}
template <class Base = null_archetype<> >
class equality_comparable2_first_archetype : public Base {
public:
equality_comparable2_first_archetype(detail::dummy_constructor x)
: Base(x) { }
};
template <class Base = null_archetype<> >
class equality_comparable2_second_archetype : public Base {
public:
equality_comparable2_second_archetype(detail::dummy_constructor x)
: Base(x) { }
};
template <class Base1, class Base2>
boolean_archetype
operator==(const equality_comparable2_first_archetype<Base1>&,
const equality_comparable2_second_archetype<Base2>&)
{
return boolean_archetype(static_object<detail::dummy_constructor>::get());
}
template <class Base1, class Base2>
boolean_archetype
operator!=(const equality_comparable2_first_archetype<Base1>&,
const equality_comparable2_second_archetype<Base2>&)
{
return boolean_archetype(static_object<detail::dummy_constructor>::get());
}
template <class Base = null_archetype<> >
class less_than_comparable_archetype : public Base {
public:
less_than_comparable_archetype(detail::dummy_constructor x) : Base(x) { }
};
template <class Base>
boolean_archetype
operator<(const less_than_comparable_archetype<Base>&,
const less_than_comparable_archetype<Base>&)
{
return boolean_archetype(static_object<detail::dummy_constructor>::get());
}
template <class Base = null_archetype<> >
class comparable_archetype : public Base {
public:
comparable_archetype(detail::dummy_constructor x) : Base(x) { }
};
template <class Base>
boolean_archetype
operator<(const comparable_archetype<Base>&,
const comparable_archetype<Base>&)
{
return boolean_archetype(static_object<detail::dummy_constructor>::get());
}
template <class Base>
boolean_archetype
operator<=(const comparable_archetype<Base>&,
const comparable_archetype<Base>&)
{
return boolean_archetype(static_object<detail::dummy_constructor>::get());
}
template <class Base>
boolean_archetype
operator>(const comparable_archetype<Base>&,
const comparable_archetype<Base>&)
{
return boolean_archetype(static_object<detail::dummy_constructor>::get());
}
template <class Base>
boolean_archetype
operator>=(const comparable_archetype<Base>&,
const comparable_archetype<Base>&)
{
return boolean_archetype(static_object<detail::dummy_constructor>::get());
}
// The purpose of the optags is so that one can specify
// exactly which types the operator< is defined between.
// This is useful for allowing the operations:
//
// A a; B b;
// a < b
// b < a
//
// without also allowing the combinations:
//
// a < a
// b < b
//
struct optag1 { };
struct optag2 { };
struct optag3 { };
#define BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(OP, NAME) \
template <class Base = null_archetype<>, class Tag = optag1 > \
class NAME##_first_archetype : public Base { \
public: \
NAME##_first_archetype(detail::dummy_constructor x) : Base(x) { } \
}; \
\
template <class Base = null_archetype<>, class Tag = optag1 > \
class NAME##_second_archetype : public Base { \
public: \
NAME##_second_archetype(detail::dummy_constructor x) : Base(x) { } \
}; \
\
template <class BaseFirst, class BaseSecond, class Tag> \
boolean_archetype \
operator OP (const NAME##_first_archetype<BaseFirst, Tag>&, \
const NAME##_second_archetype<BaseSecond, Tag>&) \
{ \
return boolean_archetype(static_object<detail::dummy_constructor>::get()); \
}
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(==, equal_op)
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(!=, not_equal_op)
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(<, less_than_op)
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(<=, less_equal_op)
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(>, greater_than_op)
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(>=, greater_equal_op)
#define BOOST_DEFINE_OPERATOR_ARCHETYPE(OP, NAME) \
template <class Base = null_archetype<> > \
class NAME##_archetype : public Base { \
public: \
NAME##_archetype(detail::dummy_constructor x) : Base(x) { } \
NAME##_archetype(const NAME##_archetype&) \
: Base(static_object<detail::dummy_constructor>::get()) { } \
NAME##_archetype& operator=(const NAME##_archetype&) { return *this; } \
}; \
template <class Base> \
NAME##_archetype<Base> \
operator OP (const NAME##_archetype<Base>&,\
const NAME##_archetype<Base>&) \
{ \
return \
NAME##_archetype<Base>(static_object<detail::dummy_constructor>::get()); \
}
BOOST_DEFINE_OPERATOR_ARCHETYPE(+, addable)
BOOST_DEFINE_OPERATOR_ARCHETYPE(-, subtractable)
BOOST_DEFINE_OPERATOR_ARCHETYPE(*, multipliable)
BOOST_DEFINE_OPERATOR_ARCHETYPE(/, dividable)
BOOST_DEFINE_OPERATOR_ARCHETYPE(%, modable)
// As is, these are useless because of the return type.
// Need to invent a better way...
#define BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(OP, NAME) \
template <class Return, class Base = null_archetype<> > \
class NAME##_first_archetype : public Base { \
public: \
NAME##_first_archetype(detail::dummy_constructor x) : Base(x) { } \
}; \
\
template <class Return, class Base = null_archetype<> > \
class NAME##_second_archetype : public Base { \
public: \
NAME##_second_archetype(detail::dummy_constructor x) : Base(x) { } \
}; \
\
template <class Return, class BaseFirst, class BaseSecond> \
Return \
operator OP (const NAME##_first_archetype<Return, BaseFirst>&, \
const NAME##_second_archetype<Return, BaseSecond>&) \
{ \
return Return(static_object<detail::dummy_constructor>::get()); \
}
BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(+, plus_op)
BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(*, time_op)
BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(/, divide_op)
BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(-, subtract_op)
BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(%, mod_op)
//===========================================================================
// Function Object Archetype Classes
template <class Return>
class generator_archetype {
public:
const Return& operator()() {
return static_object<Return>::get();
}
};
class void_generator_archetype {
public:
void operator()() { }
};
template <class Arg, class Return>
class unary_function_archetype {
private:
unary_function_archetype() { }
public:
unary_function_archetype(detail::dummy_constructor) { }
const Return& operator()(const Arg&) const {
return static_object<Return>::get();
}
};
template <class Arg1, class Arg2, class Return>
class binary_function_archetype {
private:
binary_function_archetype() { }
public:
binary_function_archetype(detail::dummy_constructor) { }
const Return& operator()(const Arg1&, const Arg2&) const {
return static_object<Return>::get();
}
};
template <class Arg>
class unary_predicate_archetype {
typedef boolean_archetype Return;
unary_predicate_archetype() { }
public:
unary_predicate_archetype(detail::dummy_constructor) { }
const Return& operator()(const Arg&) const {
return static_object<Return>::get();
}
};
template <class Arg1, class Arg2, class Base = null_archetype<> >
class binary_predicate_archetype {
typedef boolean_archetype Return;
binary_predicate_archetype() { }
public:
binary_predicate_archetype(detail::dummy_constructor) { }
const Return& operator()(const Arg1&, const Arg2&) const {
return static_object<Return>::get();
}
};
//===========================================================================
// Iterator Archetype Classes
template <class T, int I = 0>
class input_iterator_archetype
{
private:
typedef input_iterator_archetype self;
public:
typedef std::input_iterator_tag iterator_category;
typedef T value_type;
struct reference {
operator const value_type&() const { return static_object<T>::get(); }
};
typedef const T* pointer;
typedef std::ptrdiff_t difference_type;
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return reference(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
};
template <class T>
class input_iterator_archetype_no_proxy
{
private:
typedef input_iterator_archetype_no_proxy self;
public:
typedef std::input_iterator_tag iterator_category;
typedef T value_type;
typedef const T& reference;
typedef const T* pointer;
typedef std::ptrdiff_t difference_type;
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return static_object<T>::get(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
};
template <class T>
struct output_proxy {
output_proxy& operator=(const T&) { return *this; }
};
template <class T>
class output_iterator_archetype
{
public:
typedef output_iterator_archetype self;
public:
typedef std::output_iterator_tag iterator_category;
typedef output_proxy<T> value_type;
typedef output_proxy<T> reference;
typedef void pointer;
typedef void difference_type;
output_iterator_archetype(detail::dummy_constructor) { }
output_iterator_archetype(const self&) { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return output_proxy<T>(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
private:
output_iterator_archetype() { }
};
template <class T>
class input_output_iterator_archetype
{
private:
typedef input_output_iterator_archetype self;
struct in_out_tag : public std::input_iterator_tag, public std::output_iterator_tag { };
public:
typedef in_out_tag iterator_category;
typedef T value_type;
struct reference {
reference& operator=(const T&) { return *this; }
operator value_type() { return static_object<T>::get(); }
};
typedef const T* pointer;
typedef std::ptrdiff_t difference_type;
input_output_iterator_archetype() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return reference(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
};
template <class T>
class forward_iterator_archetype
{
public:
typedef forward_iterator_archetype self;
public:
typedef std::forward_iterator_tag iterator_category;
typedef T value_type;
typedef const T& reference;
typedef T const* pointer;
typedef std::ptrdiff_t difference_type;
forward_iterator_archetype() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return static_object<T>::get(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
};
template <class T>
class mutable_forward_iterator_archetype
{
public:
typedef mutable_forward_iterator_archetype self;
public:
typedef std::forward_iterator_tag iterator_category;
typedef T value_type;
typedef T& reference;
typedef T* pointer;
typedef std::ptrdiff_t difference_type;
mutable_forward_iterator_archetype() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return static_object<T>::get(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
};
template <class T>
class bidirectional_iterator_archetype
{
public:
typedef bidirectional_iterator_archetype self;
public:
typedef std::bidirectional_iterator_tag iterator_category;
typedef T value_type;
typedef const T& reference;
typedef T* pointer;
typedef std::ptrdiff_t difference_type;
bidirectional_iterator_archetype() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return static_object<T>::get(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
self& operator--() { return *this; }
self operator--(int) { return *this; }
};
template <class T>
class mutable_bidirectional_iterator_archetype
{
public:
typedef mutable_bidirectional_iterator_archetype self;
public:
typedef std::bidirectional_iterator_tag iterator_category;
typedef T value_type;
typedef T& reference;
typedef T* pointer;
typedef std::ptrdiff_t difference_type;
mutable_bidirectional_iterator_archetype() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return static_object<T>::get(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
self& operator--() { return *this; }
self operator--(int) { return *this; }
};
template <class T>
class random_access_iterator_archetype
{
public:
typedef random_access_iterator_archetype self;
public:
typedef std::random_access_iterator_tag iterator_category;
typedef T value_type;
typedef const T& reference;
typedef T* pointer;
typedef std::ptrdiff_t difference_type;
random_access_iterator_archetype() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return static_object<T>::get(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
self& operator--() { return *this; }
self operator--(int) { return *this; }
reference operator[](difference_type) const
{ return static_object<T>::get(); }
self& operator+=(difference_type) { return *this; }
self& operator-=(difference_type) { return *this; }
difference_type operator-(const self&) const
{ return difference_type(); }
self operator+(difference_type) const { return *this; }
self operator-(difference_type) const { return *this; }
bool operator<(const self&) const { return true; }
bool operator<=(const self&) const { return true; }
bool operator>(const self&) const { return true; }
bool operator>=(const self&) const { return true; }
};
template <class T>
random_access_iterator_archetype<T>
operator+(typename random_access_iterator_archetype<T>::difference_type,
const random_access_iterator_archetype<T>& x)
{ return x; }
template <class T>
class mutable_random_access_iterator_archetype
{
public:
typedef mutable_random_access_iterator_archetype self;
public:
typedef std::random_access_iterator_tag iterator_category;
typedef T value_type;
typedef T& reference;
typedef T* pointer;
typedef std::ptrdiff_t difference_type;
mutable_random_access_iterator_archetype() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return static_object<T>::get(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
self& operator--() { return *this; }
self operator--(int) { return *this; }
reference operator[](difference_type) const
{ return static_object<T>::get(); }
self& operator+=(difference_type) { return *this; }
self& operator-=(difference_type) { return *this; }
difference_type operator-(const self&) const
{ return difference_type(); }
self operator+(difference_type) const { return *this; }
self operator-(difference_type) const { return *this; }
bool operator<(const self&) const { return true; }
bool operator<=(const self&) const { return true; }
bool operator>(const self&) const { return true; }
bool operator>=(const self&) const { return true; }
};
template <class T>
mutable_random_access_iterator_archetype<T>
operator+
(typename mutable_random_access_iterator_archetype<T>::difference_type,
const mutable_random_access_iterator_archetype<T>& x)
{ return x; }
} // namespace boost
#endif // BOOST_CONCEPT_ARCHETYPES_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
// 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_CHECK_BORLAND_DWA2006429_HPP
# define BOOST_CONCEPT_CHECK_BORLAND_DWA2006429_HPP
namespace boost {
template <class ModelFn>
struct concept_check;
template <class Model>
struct concept_check<void(*)(Model)>
{
enum { instantiate = sizeof((((Model*)0)->~Model()), 3) };
};
# define BOOST_CONCEPT_ASSERT( ModelInParens ) \
enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
boost::concept_check<void(*)ModelInParens>::instantiate \
}
} // namespace boost::concept_checking
#endif // BOOST_CONCEPT_CHECK_BORLAND_DWA2006429_HPP

View File

@@ -0,0 +1,82 @@
// 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_CHECK_MSVC_DWA2006429_HPP
# define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
# ifdef BOOST_OLD_CONCEPT_SUPPORT
# include <boost/concept_check/has_constraints.hpp>
# include <boost/type_traits/conditional.hpp>
# endif
// This implementation works on GCC and Comeau, but has actually been
// fairly carefully tuned to work on GCC versions starting with
// gcc-2.95.x. If you're trying to get an additional compiler to pass
// the tests you might consider breaking out a separate gcc.hpp and
// starting over on the general case.
namespace boost
{
namespace concept_checking
{
template <void(*)()> struct instantiate {};
}
template <class ModelFn> struct concept_check_;
template <class Model>
void concept_check_failed()
{
((Model*)0)->~Model();
}
template <class Model>
struct concept_check
{
concept_checking::instantiate<concept_check_failed<Model> > x;
enum { instantiate = 1 };
};
# ifdef BOOST_OLD_CONCEPT_SUPPORT
template <class Model>
void constraint_check_failed()
{
((Model*)0)->constraints();
}
template <class Model>
struct constraint_check
{
concept_checking::instantiate<constraint_check_failed<Model> > x;
enum { instantiate = 1 };
};
template <class Model>
struct concept_check_<void(*)(Model)>
: conditional<
concept_checking::has_constraints<Model>::value
, constraint_check<Model>
, concept_check<Model>
>::type
{};
# else
template <class Model>
struct concept_check_<void(*)(Model)>
: concept_check<Model>
{};
# endif
// Usage, in class or function context:
//
// BOOST_CONCEPT_ASSERT((UnaryFunctionConcept<F,bool,int>));
# define BOOST_CONCEPT_ASSERT( ModelInParens ) \
enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
::boost::concept_check_<void(*) ModelInParens>::instantiate \
}
}
#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP

View File

@@ -0,0 +1,31 @@
// 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_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP
# define BOOST_CONCEPT_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP
namespace boost { namespace concept_checking {
// Here we implement the "metafunction" that detects whether a
// constraints metafunction exists
typedef char yes;
typedef char (&no)[2];
template <class Model, void (Model::*)()>
struct wrap_constraints {};
template <class Model>
inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
inline no has_constraints_(...);
template <class Model>
struct has_constraints
{
BOOST_STATIC_CONSTANT(
bool
, value = sizeof( concept_checking::has_constraints_((Model*)0) ) == 1 );
};
}} // namespace boost::concept_checking
#endif // BOOST_CONCEPT_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP

View File

@@ -0,0 +1,90 @@
// 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_CHECK_MSVC_DWA2006429_HPP
# define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
# ifdef BOOST_OLD_CONCEPT_SUPPORT
# include <boost/concept_check/has_constraints.hpp>
# include <boost/type_traits/conditional.hpp>
# endif
namespace boost
{
namespace concept_checking
{
template <class Model>
struct concept_check_
{
virtual void failed(Model* x)
{
x->~Model();
}
};
}
# ifdef BOOST_OLD_CONCEPT_SUPPORT
namespace concept_checking
{
template <class Model>
struct constraint_check
{
virtual void failed(Model* x)
{
x->constraints();
}
};
}
template <class Model>
struct concept_check
: conditional<
concept_checking::has_constraints<Model>::value
, concept_checking::constraint_check<Model>
, concept_checking::concept_check_<Model>
>::type
{};
# else
template <class Model>
struct concept_check
: concept_checking::concept_check_<Model>
{};
# endif
# if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
//
// The iterator library sees some really strange errors unless we
// use partial specialization to extract the model type with
// msvc-7.1
//
template <class Model>
struct concept_check<void(*)(Model)>
: concept_check<Model>
{ };
# define BOOST_CONCEPT_ASSERT( ModelInParens ) \
enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
sizeof(::boost::concept_check<void(*) ModelInParens>) \
}
# else
template <class Model>
concept_check<Model>
concept_check_(void(*)(Model));
# define BOOST_CONCEPT_ASSERT( ModelInParens ) \
enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
sizeof(::boost::concept_check_((void(*) ModelInParens)0)) \
}
# endif
}
#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP