diff --git a/include/boost/concept_check/assert.hpp b/include/boost/concept/assert.hpp similarity index 83% rename from include/boost/concept_check/assert.hpp rename to include/boost/concept/assert.hpp index 81bcc51..8d689ea 100755 --- a/include/boost/concept_check/assert.hpp +++ b/include/boost/concept/assert.hpp @@ -1,8 +1,8 @@ // 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_ASSERT_DWA2006430_HPP -# define BOOST_CONCEPT_CHECK_ASSERT_DWA2006430_HPP +#ifndef BOOST_CONCEPT_ASSERT_DWA2006430_HPP +# define BOOST_CONCEPT_ASSERT_DWA2006430_HPP # include # include @@ -25,11 +25,11 @@ # endif # ifdef BOOST_MSVC -# include +# include # elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -# include +# include # else -# include +# include # endif // Usage, in class or function context: @@ -39,4 +39,4 @@ # define BOOST_CONCEPT_ASSERT(ModelInParens) \ BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) -#endif // BOOST_CONCEPT_CHECK_ASSERT_DWA2006430_HPP +#endif // BOOST_CONCEPT_ASSERT_DWA2006430_HPP diff --git a/include/boost/concept_check/Attic/borland.hpp b/include/boost/concept/detail/borland.hpp similarity index 63% rename from include/boost/concept_check/Attic/borland.hpp rename to include/boost/concept/detail/borland.hpp index f82c1c8..59fec55 100755 --- a/include/boost/concept_check/Attic/borland.hpp +++ b/include/boost/concept/detail/borland.hpp @@ -1,18 +1,18 @@ // 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 +#ifndef BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP +# define BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP # include -namespace boost { +namespace boost { namespace concept { template -struct concept_check; +struct require; template -struct concept_check +struct require { enum { instantiate = sizeof((((Model*)0)->~Model()), 3) }; }; @@ -21,9 +21,9 @@ struct concept_check enum \ { \ BOOST_PP_CAT(boost_concept_check,__LINE__) = \ - boost::concept_check::instantiate \ + boost::concept::require::instantiate \ } -} // namespace boost::concept_checking +}} // namespace boost::concept -#endif // BOOST_CONCEPT_CHECK_BORLAND_DWA2006429_HPP +#endif // BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP diff --git a/include/boost/concept/detail/general.hpp b/include/boost/concept/detail/general.hpp new file mode 100755 index 0000000..f36f9c4 --- /dev/null +++ b/include/boost/concept/detail/general.hpp @@ -0,0 +1,66 @@ +// 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 + +# ifdef BOOST_OLD_CONCEPT_SUPPORT +# include +# include +# endif + +// This implementation works on Comeau and GCC, all the way back to +// 2.95 +namespace boost { namespace concept { + +template +struct requirement_; + +namespace detail +{ + template struct instantiate {}; +} + +template +struct requirement +{ + static void failed() { ((Model*)0)->~Model(); } +}; + +# ifdef BOOST_OLD_CONCEPT_SUPPORT + +template +struct constraint +{ + static void failed() { ((Model*)0)->constraints(); } +}; + +template +struct requirement_ + : mpl::if_< + concept::not_satisfied + , constraint + , requirement + >::type +{}; + +# else + +// For GCC-2.x, these can't have exactly the same name +template +struct requirement_ + : requirement +{}; + +# endif + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ + typedef ::boost::concept::detail::instantiate< \ + &::boost::concept::requirement_::failed> \ + BOOST_PP_CAT(boost_concept_check,__LINE__) + +}} + +#endif // BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP diff --git a/include/boost/concept/detail/has_constraints.hpp b/include/boost/concept/detail/has_constraints.hpp new file mode 100755 index 0000000..7ffbb24 --- /dev/null +++ b/include/boost/concept/detail/has_constraints.hpp @@ -0,0 +1,40 @@ +// 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 + +namespace boost { namespace concept { + +namespace detail +{ + +// Here we implement the metafunction that detects whether a +// constraints metafunction exists + typedef char yes; + typedef char (&no)[2]; + + template + struct wrap_constraints {}; + + template + inline yes has_constraints_(Model*, wrap_constraints* = 0); + inline no has_constraints_(...); +} + +// This would be called "detail::has_constraints," but it has a strong +// tendency to show up in error messages. +template +struct not_satisfied +{ + BOOST_STATIC_CONSTANT( + bool + , value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) ); + typedef mpl::bool_ type; +}; + +}} // namespace boost::concept::detail + +#endif // BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP diff --git a/include/boost/concept/detail/msvc.hpp b/include/boost/concept/detail/msvc.hpp new file mode 100755 index 0000000..7165d44 --- /dev/null +++ b/include/boost/concept/detail/msvc.hpp @@ -0,0 +1,88 @@ +// 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 + +# ifdef BOOST_OLD_CONCEPT_SUPPORT +# include +# include +# endif + + +namespace boost { namespace concept { + +template +struct check +{ + virtual void failed(Model* x) + { + x->~Model(); + } +}; + +# ifdef BOOST_OLD_CONCEPT_SUPPORT + +namespace detail +{ + // No need for a virtual function here, since evaluatiing + // not_satisfied below will have already instantiated the + // constraints() member. + struct constraint {}; +} +template +struct require + : mpl::if_c< + not_satisfied::value + , detail::constraint + , check + >::type +{}; + +# else + +template +struct require + : check +{}; + +# 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 +struct require + : require +{}; + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ +enum \ +{ \ + BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + sizeof(::boost::concept::require) \ +} + +# else // Not vc-7.1 + +template +require +require_(void(*)(Model)); + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ +enum \ +{ \ + BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + sizeof(::boost::concept::require_((ModelFnPtr)0)) \ +} + +# endif +}} + +#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP diff --git a/include/boost/concept_check/where.hpp b/include/boost/concept/where.hpp similarity index 89% rename from include/boost/concept_check/where.hpp rename to include/boost/concept/where.hpp index c6a6248..eec01b7 100755 --- a/include/boost/concept_check/where.hpp +++ b/include/boost/concept/where.hpp @@ -1,11 +1,11 @@ // 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_WHERE_DWA2006430_HPP -# define BOOST_CONCEPT_CHECK_WHERE_DWA2006430_HPP +#ifndef BOOST_CONCEPT_WHERE_DWA2006430_HPP +# define BOOST_CONCEPT_WHERE_DWA2006430_HPP # include -# include +# include # include namespace boost { @@ -47,4 +47,4 @@ struct where : More } // namespace boost::concept_check -#endif // BOOST_CONCEPT_CHECK_WHERE_DWA2006430_HPP +#endif // BOOST_CONCEPT_WHERE_DWA2006430_HPP diff --git a/include/boost/concept_check.hpp b/include/boost/concept_check.hpp index c89983e..2169a8d 100644 --- a/include/boost/concept_check.hpp +++ b/include/boost/concept_check.hpp @@ -15,7 +15,7 @@ #ifndef BOOST_CONCEPT_CHECKS_HPP # define BOOST_CONCEPT_CHECKS_HPP -# include +# include # include # include @@ -35,7 +35,7 @@ namespace boost // template - inline void function_requires(BOOST_EXPLICIT_TEMPLATE_TYPE(Model)) + inline void function_requires(Model* = 0) { BOOST_CONCEPT_ASSERT((Model)); } diff --git a/include/boost/concept_check/Attic/general.hpp b/include/boost/concept_check/Attic/general.hpp deleted file mode 100755 index f9e0274..0000000 --- a/include/boost/concept_check/Attic/general.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// 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 -# include - -# ifdef BOOST_OLD_CONCEPT_SUPPORT -# include -# include -# endif - -// This implementation works on Comeau and GCC, all the way back to -// 2.95 -namespace boost -{ - template - struct concept_check_; - - namespace concept_checking - { - template struct instantiate {}; - } - - template - struct concept_check - { - static void failed() { ((Model*)0)->~Model(); } - }; - -# ifdef BOOST_OLD_CONCEPT_SUPPORT - - template - struct constraint_check - { - static void failed() { ((Model*)0)->constraints(); } - }; - - template - struct concept_check_ - : mpl::if_c< - concept_checking::has_constraints::value - , constraint_check - , concept_check - >::type - {}; - -# else - - template - struct concept_check_ - : concept_check - {}; - -# endif - -# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ - typedef boost::concept_checking::instantiate< \ - &boost::concept_check_::failed> \ - BOOST_PP_CAT(boost_concept_check,__LINE__) - -} - -#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP diff --git a/include/boost/concept_check/Attic/has_constraints.hpp b/include/boost/concept_check/Attic/has_constraints.hpp deleted file mode 100755 index e19f664..0000000 --- a/include/boost/concept_check/Attic/has_constraints.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// 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 -struct wrap_constraints {}; - -template -inline yes has_constraints_(Model*, wrap_constraints* = 0); -inline no has_constraints_(...); - -template -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 diff --git a/include/boost/concept_check/Attic/msvc.hpp b/include/boost/concept_check/Attic/msvc.hpp deleted file mode 100755 index 2edcd28..0000000 --- a/include/boost/concept_check/Attic/msvc.hpp +++ /dev/null @@ -1,99 +0,0 @@ -// 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 - -# ifdef BOOST_OLD_CONCEPT_SUPPORT -# include -# include -# endif - - -namespace boost -{ - namespace concept_checking - { - template - struct concept_check_ - { - ~concept_check_(); - virtual void failed(Model* x) - { - x->~Model(); - } - }; - } - -# ifdef BOOST_OLD_CONCEPT_SUPPORT - - namespace concept_checking - { - template - struct constraint_check - { - virtual void failed(Model* x) - { - x->constraints(); - } - }; - } - - template - struct concept_check - : mpl::if_c< - concept_checking::has_constraints::value - , concept_checking::constraint_check - , concept_checking::concept_check_ - >::type - {}; - -# else - - template - struct concept_check - : concept_checking::concept_check_ - { - ~concept_check(); - }; - -# 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 - struct concept_check - : concept_check - { }; - -# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ - enum \ - { \ - BOOST_PP_CAT(boost_concept_check,__LINE__) = \ - sizeof(::boost::concept_check) \ - } - -# else - - template - concept_check - concept_check_(void(*)(Model)); - -# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ - enum \ - { \ - BOOST_PP_CAT(boost_concept_check,__LINE__) = \ - sizeof(::boost::concept_check_((ModelFnPtr)0)) \ - } - -# endif -} - -#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP