Squashed 'third_party/boostorg/concept_check/' content from commit ed0a0eb
Change-Id: Ib7230965334f9501601efc300242efde8352a380
git-subtree-dir: third_party/boostorg/concept_check
git-subtree-split: ed0a0ebd72f778cfa4931e0538ea34c28db3a42b
diff --git a/include/boost/concept_check/borland.hpp b/include/boost/concept_check/borland.hpp
new file mode 100644
index 0000000..107926b
--- /dev/null
+++ b/include/boost/concept_check/borland.hpp
@@ -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
diff --git a/include/boost/concept_check/general.hpp b/include/boost/concept_check/general.hpp
new file mode 100644
index 0000000..cd09fb0
--- /dev/null
+++ b/include/boost/concept_check/general.hpp
@@ -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/mpl/if.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)>
+ : mpl::if_c<
+ 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
diff --git a/include/boost/concept_check/has_constraints.hpp b/include/boost/concept_check/has_constraints.hpp
new file mode 100644
index 0000000..e19f664
--- /dev/null
+++ b/include/boost/concept_check/has_constraints.hpp
@@ -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
diff --git a/include/boost/concept_check/msvc.hpp b/include/boost/concept_check/msvc.hpp
new file mode 100644
index 0000000..3968469
--- /dev/null
+++ b/include/boost/concept_check/msvc.hpp
@@ -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/mpl/if.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
+ : mpl::if_c<
+ 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