|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66304 - sandbox/tti/boost/tti/detail
From: eldiener_at_[hidden]
Date: 2010-10-31 23:19:49
Author: eldiener
Date: 2010-10-31 23:19:48 EDT (Sun, 31 Oct 2010)
New Revision: 66304
URL: http://svn.boost.org/trac/boost/changeset/66304
Log:
Header detail file
Added:
sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp (contents, props changed)
Added: sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp 2010-10-31 23:19:48 EDT (Sun, 31 Oct 2010)
@@ -0,0 +1,199 @@
+#if !defined(TT_INTROSPECTION_DETAIL_HPP)
+#define TT_INTROSPECTION_DETAIL_HPP
+
+#pragma once
+#include <boost/config.hpp>
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/preprocessor/array/elem.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/arithmetic/add.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/array/size.hpp>
+
+#if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
+#define TTI_DETAIL_TEMPLATE_PARAMETERS(z,n,args) \
+BOOST_PP_ARRAY_ELEM(BOOST_PP_ADD(4,n),args) \
+/**/
+#define TTI_DETAIL_HAS_MEMBER_IMPLEMENTATION(args,introspect_macro) \
+ template \
+ < \
+ typename T, \
+ typename fallback_ \
+ = boost::mpl::bool_< BOOST_PP_ARRAY_ELEM(3, args) > \
+ > \
+ class BOOST_PP_ARRAY_ELEM(0, args) \
+ { \
+ introspect_macro(args) \
+ public: \
+ static const bool value \
+ = BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args)< T >::value; \
+ typedef typename BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args) \
+ < \
+ T \
+ >::type type; \
+ }; \
+/**/
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+#define TTI_DETAIL_HAS_MEMBER_MULTI_SUBSTITUTE(z,n,args) \
+ template \
+ < \
+ template \
+ < \
+ BOOST_PP_ENUM_ ## z \
+ ( \
+ BOOST_PP_SUB \
+ ( \
+ BOOST_PP_ARRAY_SIZE(args), \
+ 4 \
+ ), \
+ TTI_DETAIL_TEMPLATE_PARAMETERS, \
+ args \
+ ) \
+ > \
+ class V \
+ > \
+ struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME(args, n) \
+ { \
+ }; \
+/**/
+#define TTI_DETAIL_HAS_MEMBER_SUBSTITUTE(args) \
+ BOOST_PP_REPEAT \
+ ( \
+ BOOST_PP_ARRAY_ELEM(2, args), \
+ TTI_DETAIL_HAS_MEMBER_MULTI_SUBSTITUTE, \
+ args \
+ ) \
+/**/
+#define TTI_DETAIL_HAS_MEMBER_INTROSPECT(args) \
+ template< typename U > \
+ struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args) \
+ { \
+ TTI_DETAIL_HAS_MEMBER_SUBSTITUTE(args) \
+ BOOST_MPL_HAS_MEMBER_REJECT(args, BOOST_PP_NIL) \
+ BOOST_MPL_HAS_MEMBER_ACCEPT(args, BOOST_PP_NIL) \
+ BOOST_STATIC_CONSTANT \
+ ( \
+ bool, value = BOOST_MPL_HAS_MEMBER_TEST(args) \
+ ); \
+ typedef boost::mpl::bool_< value > type; \
+ }; \
+/**/
+#define TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE(args) \
+ TTI_DETAIL_HAS_MEMBER_IMPLEMENTATION \
+ ( \
+ args, \
+ TTI_DETAIL_HAS_MEMBER_INTROSPECT \
+ ) \
+/**/
+#else
+#define TTI_DETAIL_HAS_MEMBER_MULTI_SUBSTITUTE_WITH_TEMPLATE_SFINAE(z,n,args) \
+ template \
+ < \
+ template \
+ < \
+ BOOST_PP_ENUM_ ## z \
+ ( \
+ BOOST_PP_SUB \
+ ( \
+ BOOST_PP_ARRAY_SIZE(args), \
+ 4 \
+ ), \
+ TTI_DETAIL_TEMPLATE_PARAMETERS, \
+ args \
+ ) \
+ > \
+ class U \
+ > \
+ struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME_WITH_TEMPLATE_SFINAE \
+ ( \
+ args, \
+ n \
+ ) \
+ { \
+ typedef \
+ BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_TAG_NAME(args) \
+ type; \
+ }; \
+/**/
+#define TTI_DETAIL_HAS_MEMBER_SUBSTITUTE_WITH_TEMPLATE_SFINAE(args) \
+ typedef void \
+ BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_TAG_NAME(args); \
+ BOOST_PP_REPEAT \
+ ( \
+ BOOST_PP_ARRAY_ELEM(2, args), \
+ TTI_DETAIL_HAS_MEMBER_MULTI_SUBSTITUTE_WITH_TEMPLATE_SFINAE, \
+ args \
+ ) \
+/**/
+#define TTI_DETAIL_HAS_MEMBER_INTROSPECT_WITH_TEMPLATE_SFINAE(args) \
+ BOOST_MPL_HAS_MEMBER_REJECT_WITH_TEMPLATE_SFINAE(args,BOOST_PP_NIL) \
+ BOOST_MPL_HAS_MEMBER_ACCEPT_WITH_TEMPLATE_SFINAE(args,BOOST_PP_NIL) \
+ template< typename U > \
+ struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args) \
+ : BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)< U > { \
+ }; \
+/**/
+#define TTI_DETAIL_HAS_MEMBER_WITH_TEMPLATE_SFINAE(args) \
+ TTI_DETAIL_HAS_MEMBER_SUBSTITUTE_WITH_TEMPLATE_SFINAE \
+ ( \
+ args \
+ ) \
+ TTI_DETAIL_HAS_MEMBER_IMPLEMENTATION \
+ ( \
+ args, \
+ TTI_DETAIL_HAS_MEMBER_INTROSPECT_WITH_TEMPLATE_SFINAE \
+ ) \
+/**/
+#endif
+#else
+#define TTI_DETAIL_SAME(trait,name) \
+namespace tti \
+ { \
+ BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF \
+ ( \
+ trait, \
+ name, \
+ false \
+ ) \
+ } \
+/**/
+#endif
+
+#define TTI_DETAIL_TRAIT_MEMBER_TYPE(trait,name) \
+namespace membertype \
+ { \
+ template<class T> \
+ struct trait \
+ { \
+ typedef typename T::name type; \
+ }; \
+ } \
+/**/
+
+#define TTI_DETAIL_TRAIT_HAS_TYPE(trait,name) \
+namespace mpl \
+ { \
+ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, false) \
+ } \
+template<class T> \
+struct trait \
+ { \
+ typedef typename tti::detail::mpl::trait<T>::type type; \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=type::value); \
+ }; \
+/**/
+
+namespace tti
+ {
+ namespace detail
+ {
+ struct notype
+ {
+ };
+ }
+ }
+
+#endif // TT_INTROSPECTION_DETAIL_HPP
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk