Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80852 - in sandbox/enable_if: . include include/boost include/boost/utility libs libs/enable_if libs/enable_if/doc libs/enable_if/test
From: rivorus_at_[hidden]
Date: 2012-10-04 16:47:08


Author: matt_calabrese
Date: 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
New Revision: 80852
URL: http://svn.boost.org/trac/boost/changeset/80852

Log:
Enable_If Macros, initial commit.
Added:
   sandbox/enable_if/
   sandbox/enable_if/include/
   sandbox/enable_if/include/boost/
   sandbox/enable_if/include/boost/utility/
   sandbox/enable_if/include/boost/utility/enable_if_macros.hpp (contents, props changed)
   sandbox/enable_if/libs/
   sandbox/enable_if/libs/enable_if/
   sandbox/enable_if/libs/enable_if/doc/
   sandbox/enable_if/libs/enable_if/test/
   sandbox/enable_if/libs/enable_if/test/Jamfile (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/disable_if.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/disable_if_c.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/enable_if.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/enable_if_c.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/enable_if_expr.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/enable_if_expr_seq.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/lazy_disable_if.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/lazy_disable_if_c.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/lazy_enable_if.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/lazy_enable_if_c.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/lazy_enable_if_expr.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/lazy_enable_if_expr_seq.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/type_disable_if.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/type_disable_if_c.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/type_enable_if.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/type_enable_if_c.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/type_enable_if_expr.cpp (contents, props changed)
   sandbox/enable_if/libs/enable_if/test/type_enable_if_expr_seq.cpp (contents, props changed)
   sandbox/enable_if/project-root.jam (contents, props changed)

Added: sandbox/enable_if/include/boost/utility/enable_if_macros.hpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/include/boost/utility/enable_if_macros.hpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,306 @@
+/*==============================================================================
+ Copyright (c) 2011, 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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_ENABLE_IF_MACROS_HPP
+#define BOOST_ENABLE_IF_MACROS_HPP
+
+#include <boost/config.hpp>
+
+// TODO: Add check for relaxed typename rule
+#if defined( BOOST_NO_VARIADIC_MACROS ) \
+ || defined( BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS ) \
+ || defined( BOOST_NO_DECLTYPE )
+
+#define BOOST_NO_ENABLE_IF_MACRO
+
+#else
+
+#include <boost/mpl/bool.hpp>
+#include <boost/preprocessor/array/data.hpp>
+#include <boost/preprocessor/array/pop_front.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/seq/for_each.hpp>
+#include <boost/preprocessor/seq/variadic_seq_to_seq.hpp>
+#include <boost/preprocessor/tuple/enum.hpp>
+#include <boost/preprocessor/tuple/to_array.hpp>
+#include <boost/preprocessor/variadic/to_seq.hpp>
+#include <boost/type_traits/function_traits.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/variadic_macro_data/vmd_is_begin_parens.hpp>
+
+////////////////////////////////////////////////////////////////////////////////
+// Requires C++11 features:
+// Default template arguments to function templates
+// Variadic macros
+// Relaxed typename rule
+// decltype
+//
+// Example Usage:
+//
+// struct foo
+// {
+// typedef float value_type;
+// template< BOOST_ENABLE_IF( boost::is_floating_point< value_type > ) >
+// operator long double() const { return 0.l; }
+// };
+//
+////////////////////////////////////////////////////////////////////////////////
+
+namespace boost { namespace enable_if_detail {
+
+template< class Dummy, bool C >
+struct enable_if_c_impl : boost::enable_if_c< C, int > {};
+
+template< class Dummy, bool C >
+struct disable_if_c_impl : boost::enable_if_c< !C, int > {};
+
+template< class Dummy, bool C, class LazyType >
+struct lazy_enable_if_c_impl : boost::enable_if_c< C, LazyType > {};
+
+template< class Dummy, bool C, class LazyType >
+struct lazy_disable_if_c_impl : boost::enable_if_c< !C, LazyType > {};
+
+template< class Dummy, class C >
+struct enable_if_impl : boost::enable_if_c< C::value, int > {};
+
+template< class Dummy, class C >
+struct disable_if_impl : boost::enable_if_c< !C::value, int > {};
+
+template< class Dummy, class C, class LazyType >
+struct lazy_enable_if_impl : boost::enable_if_c< C::value, LazyType > {};
+
+template< class Dummy, class C, class LazyType >
+struct lazy_disable_if_impl : boost::enable_if_c< !C::value, LazyType > {};
+
+template< class... T > struct always_int { typedef int type; };
+
+template< class... T > struct always_true { static bool const value = true; };
+
+template< class... T > struct always_void { typedef void type; };
+
+} }
+
+#define BOOST_TYPE_ENABLE_IF( ... ) \
+typename ::boost::enable_if_c< __VA_ARGS__::value >::type
+
+#define BOOST_TYPE_ENABLE_IF_C( ... ) \
+typename ::boost::enable_if_c< __VA_ARGS__ >::type
+
+#define BOOST_TYPE_DISABLE_IF( ... ) \
+typename ::boost::enable_if_c< !__VA_ARGS__::value >::type
+
+#define BOOST_TYPE_DISABLE_IF_C( ... ) \
+typename ::boost::enable_if_c< !__VA_ARGS__ >::type
+
+#define BOOST_ENABLE_IF_C( ... ) \
+BOOST_ENABLE_IF_DEFINITION_C( __VA_ARGS__ ) = 0
+
+#define BOOST_ENABLE_IF_DEFINITION_C( ... ) \
+class BoostDetailEnableIfDependentType = void, \
+typename ::boost::enable_if_detail::enable_if_c_impl \
+< BoostDetailEnableIfDependentType \
+, ( __VA_ARGS__ ) \
+>::type
+
+#define BOOST_DISABLE_IF_C( ... ) \
+BOOST_DISABLE_IF_DEFINITION_C( __VA_ARGS__ ) = 0
+
+#define BOOST_DISABLE_IF_DEFINITION_C( ... ) \
+class BoostDetailDisableIfDependentType = void, \
+typename ::boost::enable_if_detail::disable_if_c_impl \
+< BoostDetailDisableIfDependentType \
+, ( __VA_ARGS__ ) \
+>::type
+
+#define BOOST_ENABLE_IF( ... ) \
+class BoostDetailEnableIfDependentType = void, \
+typename ::boost::enable_if_detail::enable_if_impl \
+< BoostDetailEnableIfDependentType \
+, __VA_ARGS__ \
+>::type = 0
+
+#define BOOST_DISABLE_IF( ... ) \
+class BoostDetailDisableIfDependentType = void, \
+typename ::boost::enable_if_detail::disable_if_impl \
+< BoostDetailDisableIfDependentType \
+, __VA_ARGS__ \
+>::type = 0
+
+#define BOOST_DISABLE() BOOST_DISABLE_IF_C( true )
+
+#define BOOST_DISABLED_FUNCTION( name ) template< BOOST_DISABLE() > void name();
+
+#define BOOST_LAZY( ... ) BOOST_LAZY_ENABLE_IF_C( true, __VA_ARGS__ )
+
+#define BOOST_ENABLE_IF_EXPR( ... ) \
+BOOST_PP_IIF( BOOST_VMD_IS_BEGIN_PARENS( __VA_ARGS__ ) \
+ , BOOST_ENABLE_IF_EXPR_IMPL_WITH_PAREN \
+ , BOOST_ENABLE_IF_EXPR_IMPL_NO_PAREN \
+ )( __VA_ARGS__ )
+
+#define BOOST_ENABLE_IF_EXPR_IMPL_NO_PAREN( ... ) \
+typename ::boost::enable_if_detail::always_int \
+< decltype( __VA_ARGS__ ) >::type = 0
+
+#define BOOST_ENABLE_IF_EXPR_IMPL_WITH_PAREN( ... ) \
+typename ::boost::enable_if_detail::always_int \
+< void BOOST_PP_SEQ_FOR_EACH( BOOST_ENABLE_IF_EXPR_SEQ_MACRO, ~ \
+ , BOOST_PP_VARIADIC_SEQ_TO_SEQ( __VA_ARGS__ ) \
+ ) \
+>::type = 0
+
+#define BOOST_ENABLE_IF_EXPR_SEQ_MACRO( r, data, elem ) , decltype elem
+
+#define BOOST_LAZY_ENABLE_IF_EXPR( expressions, ... ) \
+BOOST_PP_IIF( BOOST_VMD_IS_BEGIN_PARENS( expressions ) \
+ , BOOST_LAZY_ENABLE_IF_EXPR_IMPL_WITH_PAREN \
+ , BOOST_LAZY_ENABLE_IF_EXPR_IMPL_NO_PAREN \
+ )( expressions, __VA_ARGS__ )
+
+#define BOOST_LAZY_ENABLE_IF_EXPR_IMPL_NO_PAREN( expression, ... ) \
+typename ::boost::enable_if_detail::always_int \
+< decltype( expression ) >::type = 0 \
+BOOST_PP_SEQ_FOR_EACH \
+( BOOST_LAZY_ENABLE_IF_EXPR_DETAIL_MACRO \
+, ::boost::enable_if_detail::always_true< decltype( expression ) >::value \
+, BOOST_PP_VARIADIC_TO_SEQ( __VA_ARGS__ ) \
+)
+
+#define BOOST_LAZY_ENABLE_IF_EXPR_IMPL_WITH_PAREN( expressions, ... ) \
+typename ::boost::enable_if_detail::always_int \
+< void BOOST_PP_SEQ_FOR_EACH( BOOST_ENABLE_IF_EXPR_SEQ_MACRO, ~ \
+ , BOOST_PP_VARIADIC_SEQ_TO_SEQ( expressions ) \
+ ) \
+>::type = 0 \
+BOOST_PP_SEQ_FOR_EACH \
+( BOOST_LAZY_ENABLE_IF_EXPR_DETAIL_MACRO \
+, ( ::boost::enable_if_detail::always_true \
+ < void BOOST_PP_SEQ_FOR_EACH( BOOST_ENABLE_IF_EXPR_SEQ_MACRO, ~ \
+ , BOOST_PP_VARIADIC_SEQ_TO_SEQ( expressions ) \
+ ) \
+ >::value \
+ ) \
+, BOOST_PP_VARIADIC_TO_SEQ( __VA_ARGS__ ) \
+)
+
+#define BOOST_LAZY_ENABLE_IF_EXPR_DETAIL_MACRO( r, condition, lazy_init ) \
+, class BOOST_PP_TUPLE_ELEM( 0, lazy_init ) \
+= typename ::boost::enable_if_c \
+< condition \
+, BOOST_PP_TUPLE_ENUM( BOOST_DETAIL_TUPLE_POP_FRONT( lazy_init ) ) \
+>::type
+
+#define BOOST_LAZY_ENABLE_IF_C_DETAIL_MACRO( r, condition, lazy_init ) \
+, class BOOST_PP_TUPLE_ELEM( 0, lazy_init ) \
+= typename ::boost::enable_if_detail::lazy_enable_if_c_impl \
+< BoostDetailEnableIfDependentType \
+, condition \
+, BOOST_PP_TUPLE_ENUM( BOOST_DETAIL_TUPLE_POP_FRONT( lazy_init ) ) \
+>::type
+
+#define BOOST_LAZY_ENABLE_IF_C( condition, ... ) \
+class BoostDetailEnableIfDependentType = void, \
+typename ::boost::enable_if_detail::enable_if_c_impl \
+< BoostDetailEnableIfDependentType \
+, ( condition ) \
+>::type = 0 \
+BOOST_PP_SEQ_FOR_EACH \
+( BOOST_LAZY_ENABLE_IF_C_DETAIL_MACRO, ( condition ) \
+, BOOST_PP_VARIADIC_TO_SEQ( __VA_ARGS__ ) \
+)
+
+#define BOOST_LAZY_ENABLE_IF_DETAIL_MACRO( r, condition, lazy_init ) \
+, class BOOST_PP_TUPLE_ELEM( 0, lazy_init ) \
+= typename ::boost::enable_if_detail::lazy_enable_if_impl \
+< BoostDetailEnableIfDependentType \
+, BOOST_DETAIL_REMOVE_PARENTHESES_IF_WRAPPED( condition ) \
+, BOOST_PP_TUPLE_ENUM( BOOST_DETAIL_TUPLE_POP_FRONT( lazy_init ) ) \
+>::type
+
+#define BOOST_LAZY_ENABLE_IF( meta_value_in_parentheses, ... ) \
+class BoostDetailEnableIfDependentType = void, \
+typename ::boost::enable_if_detail::enable_if_impl \
+< BoostDetailEnableIfDependentType \
+, BOOST_DETAIL_REMOVE_PARENTHESES_IF_WRAPPED( meta_value_in_parentheses ) \
+>::type = 0 \
+BOOST_PP_SEQ_FOR_EACH \
+( BOOST_LAZY_ENABLE_IF_DETAIL_MACRO, meta_value_in_parentheses \
+, BOOST_PP_VARIADIC_TO_SEQ( __VA_ARGS__ ) \
+)
+
+#define BOOST_LAZY_DISABLE_IF_C_DETAIL_MACRO( r, condition, lazy_init ) \
+, class BOOST_PP_TUPLE_ELEM( 0, lazy_init ) \
+= typename ::boost::enable_if_detail::lazy_disable_if_c_impl \
+< BoostDetailEnableIfDependentType \
+, condition \
+, BOOST_PP_TUPLE_ENUM( BOOST_DETAIL_TUPLE_POP_FRONT( lazy_init ) ) \
+>::type
+
+#define BOOST_LAZY_DISABLE_IF_C( condition, ... ) \
+class BoostDetailEnableIfDependentType = void, \
+typename ::boost::enable_if_detail::disable_if_c_impl \
+< BoostDetailEnableIfDependentType \
+, ( condition ) \
+>::type = 0 \
+BOOST_PP_SEQ_FOR_EACH \
+( BOOST_LAZY_DISABLE_IF_C_DETAIL_MACRO, ( condition ) \
+, BOOST_PP_VARIADIC_TO_SEQ( __VA_ARGS__ ) \
+)
+
+#define BOOST_LAZY_DISABLE_IF_DETAIL_MACRO( r, condition, lazy_init ) \
+, class BOOST_PP_TUPLE_ELEM( 0, lazy_init ) \
+= typename ::boost::enable_if_detail::lazy_disable_if_impl \
+< BoostDetailEnableIfDependentType \
+, BOOST_DETAIL_REMOVE_PARENTHESES_IF_WRAPPED( condition ) \
+, BOOST_PP_TUPLE_ENUM( BOOST_DETAIL_TUPLE_POP_FRONT( lazy_init ) ) \
+>::type
+
+#define BOOST_LAZY_DISABLE_IF( meta_value_in_parentheses, ... ) \
+class BoostDetailEnableIfDependentType = void, \
+typename ::boost::enable_if_detail::disable_if_impl \
+< BoostDetailEnableIfDependentType \
+, BOOST_DETAIL_REMOVE_PARENTHESES_IF_WRAPPED( meta_value_in_parentheses ) \
+>::type = 0 \
+BOOST_PP_SEQ_FOR_EACH \
+( BOOST_LAZY_DISABLE_IF_DETAIL_MACRO, meta_value_in_parentheses \
+, BOOST_PP_VARIADIC_TO_SEQ( __VA_ARGS__ ) \
+)
+
+// Each expression must appear in parentheses or there should be exactly one
+// expression without parentheses
+#define BOOST_TYPE_ENABLE_IF_EXPR( ... ) \
+BOOST_PP_IIF( BOOST_VMD_IS_BEGIN_PARENS( __VA_ARGS__ ) \
+ , BOOST_TYPE_ENABLE_IF_EXPR_IMPL_WITH_PAREN \
+ , BOOST_TYPE_ENABLE_IF_EXPR_IMPL_NO_PAREN \
+ )( __VA_ARGS__ )
+
+#define BOOST_TYPE_ENABLE_IF_EXPR_IMPL_WITH_PAREN( ... ) \
+typename ::boost::enable_if_detail::always_void \
+< void BOOST_PP_SEQ_FOR_EACH( BOOST_ENABLE_IF_EXPR_SEQ_MACRO, ~ \
+ , BOOST_PP_VARIADIC_SEQ_TO_SEQ( __VA_ARGS__ ) \
+ ) \
+>::type
+
+#define BOOST_TYPE_ENABLE_IF_EXPR_IMPL_NO_PAREN( ... ) \
+typename ::boost::enable_if_detail::always_void< decltype( __VA_ARGS__ ) >::type
+
+#define BOOST_DETAIL_VARIADIC_IDENTITY( ... ) __VA_ARGS__
+
+#define BOOST_DETAIL_REMOVE_PARENTHESES_IF_WRAPPED( ... ) \
+BOOST_PP_IIF( BOOST_VMD_IS_BEGIN_PARENS( __VA_ARGS__ ) \
+ , BOOST_PP_TUPLE_ENUM \
+ , BOOST_DETAIL_VARIADIC_IDENTITY \
+ )( __VA_ARGS__ )
+
+#define BOOST_DETAIL_TUPLE_POP_FRONT( tuple ) \
+BOOST_PP_ARRAY_DATA \
+( BOOST_PP_ARRAY_POP_FRONT( BOOST_PP_TUPLE_TO_ARRAY( tuple ) ) )
+
+#endif
+
+#endif // BOOST_ENABLE_IF_MACROS_HPP

Added: sandbox/enable_if/libs/enable_if/test/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/Jamfile 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,41 @@
+#===============================================================================
+# Copyright (c) 2010 Matt Calabrese
+#
+# Use, modification and distribution is subject to 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)
+#===============================================================================
+
+import testing ;
+
+project boost_generic_test
+ : requirements
+ <include>$(boost-enable_if-include)
+ <include>$(boost-vmd-include)
+ <include>$(boost-root)
+ ;
+
+{
+ test-suite enable_if_macros :
+
+ [ compile disable_if.cpp : : : : ]
+ [ compile disable_if_c.cpp : : : : ]
+ [ compile enable_if.cpp : : : : ]
+ [ compile enable_if_c.cpp : : : : ]
+ [ compile enable_if_expr.cpp : : : : ]
+ [ compile enable_if_expr_seq.cpp : : : : ]
+ [ compile lazy_disable_if.cpp : : : : ]
+ [ compile lazy_disable_if_c.cpp : : : : ]
+ [ compile lazy_enable_if.cpp : : : : ]
+ [ compile lazy_enable_if_c.cpp : : : : ]
+ [ compile lazy_enable_if_expr.cpp : : : : ]
+ [ compile lazy_enable_if_expr_seq.cpp : : : : ]
+ [ compile type_disable_if.cpp : : : : ]
+ [ compile type_disable_if_c.cpp : : : : ]
+ [ compile type_enable_if.cpp : : : : ]
+ [ compile type_enable_if_c.cpp : : : : ]
+ [ compile type_enable_if_expr.cpp : : : : ]
+ [ compile type_enable_if_expr_seq.cpp : : : : ]
+
+ ;
+}

Added: sandbox/enable_if/libs/enable_if/test/disable_if.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/disable_if.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,36 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+boost::mpl::false_ is_arithmetic( ... );
+
+template< class T
+ , BOOST_DISABLE_IF
+ ( boost::mpl::not_< boost::is_arithmetic< T > > )
+ >
+boost::mpl::true_ is_arithmetic( T );
+
+struct not_arithmetic_t {};
+
+static_assert( decltype( is_arithmetic( 1 ) )::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( decltype( is_arithmetic( 1. ) )::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !decltype( is_arithmetic( not_arithmetic_t() ) )::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/disable_if_c.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/disable_if_c.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,35 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+boost::mpl::false_ is_arithmetic( ... );
+
+template< class T
+ , BOOST_DISABLE_IF_C
+ ( !boost::is_arithmetic< T >::value )
+ >
+boost::mpl::true_ is_arithmetic( T );
+
+struct not_arithmetic_t {};
+
+static_assert( decltype( is_arithmetic( 1 ) )::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( decltype( is_arithmetic( 1. ) )::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !decltype( is_arithmetic( not_arithmetic_t() ) )::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/enable_if.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/enable_if.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,35 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+boost::mpl::false_ is_arithmetic( ... );
+
+template< class T
+ , BOOST_ENABLE_IF
+ ( boost::is_arithmetic< T > )
+ >
+boost::mpl::true_ is_arithmetic( T );
+
+struct not_arithmetic_t {};
+
+static_assert( decltype( is_arithmetic( 1 ) )::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( decltype( is_arithmetic( 1. ) )::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !decltype( is_arithmetic( not_arithmetic_t() ) )::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/enable_if_c.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/enable_if_c.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,35 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+boost::mpl::false_ is_arithmetic( ... );
+
+template< class T
+ , BOOST_ENABLE_IF_C
+ ( boost::is_arithmetic< T >::value )
+ >
+boost::mpl::true_ is_arithmetic( T );
+
+struct not_arithmetic_t {};
+
+static_assert( decltype( is_arithmetic( 1 ) )::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( decltype( is_arithmetic( 1. ) )::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !decltype( is_arithmetic( not_arithmetic_t() ) )::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/enable_if_expr.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/enable_if_expr.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,38 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <utility>
+
+boost::mpl::false_ has_plus( ... );
+
+template< class T
+ , BOOST_ENABLE_IF_EXPR
+ ( std::declval< T >() + std::declval< T >() )
+ >
+boost::mpl::true_ has_plus( T );
+
+struct has_plus_t {};
+
+void operator +( has_plus_t const&, has_plus_t const& );
+
+struct no_plus_t {};
+
+static_assert( decltype( has_plus( 1 ) )::value
+ , "int incorrectly detected as not having plus."
+ );
+
+static_assert( decltype( has_plus( has_plus_t() ) )::value
+ , "has_plus_t incorrectly detected as not having plus."
+ );
+
+static_assert( !decltype( has_plus( no_plus_t() ) )::value
+ , "no_plus_t incorrectly detected as having plus."
+ );

Added: sandbox/enable_if/libs/enable_if/test/enable_if_expr_seq.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/enable_if_expr_seq.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,52 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <utility>
+
+boost::mpl::false_ has_plus_and_minus( ... );
+
+template< class T
+ , BOOST_ENABLE_IF_EXPR
+ ( ( std::declval< T >() + std::declval< T >() )
+ ( std::declval< T >() - std::declval< T >() )
+ )
+ >
+boost::mpl::true_ has_plus_and_minus( T );
+
+struct has_plus_t {};
+
+void operator +( has_plus_t const&, has_plus_t const& );
+
+struct has_minus_t {};
+
+void operator -( has_minus_t const&, has_minus_t const& );
+
+struct has_plus_and_minus_t {};
+
+void operator +( has_plus_and_minus_t const&, has_plus_and_minus_t const& );
+void operator -( has_plus_and_minus_t const&, has_plus_and_minus_t const& );
+
+static_assert( decltype( has_plus_and_minus( 1 ) )::value
+ , "int incorrectly detected as not having plus and minus"
+ );
+
+static_assert( !decltype( has_plus_and_minus( has_plus_t() ) )::value
+ , "has_plus_t incorrectly detected as having plus and minus"
+ );
+
+static_assert( !decltype( has_plus_and_minus( has_minus_t() ) )::value
+ , "has_minus_t incorrectly detected as having plus and minus"
+ );
+
+static_assert
+( decltype( has_plus_and_minus( has_plus_and_minus_t() ) )::value
+, "has_plus_and_minus_t incorrectly detected as not having plus and minus"
+);

Added: sandbox/enable_if/libs/enable_if/test/lazy_disable_if.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/lazy_disable_if.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,50 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+template< class T >
+struct static_assert_if_not_arithmetic
+ : boost::mpl::true_
+{
+ static_assert( boost::is_arithmetic< T >::value
+ , "Lazy type is incorrectly instantiated."
+ );
+};
+
+boost::mpl::false_ is_arithmetic( ... );
+
+template< class T
+ , BOOST_LAZY_DISABLE_IF
+ ( boost::mpl::not_< boost::is_arithmetic< T > >
+ , ( ResultType, typename static_assert_if_not_arithmetic< T >::type )
+ , ( DefaultParamType
+ , typename static_assert_if_not_arithmetic< T >::type
+ )
+ )
+ >
+ResultType is_arithmetic( T, DefaultParamType = DefaultParamType() );
+
+struct not_arithmetic_t {};
+
+static_assert( decltype( is_arithmetic( 1 ) )::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( decltype( is_arithmetic( 1. ) )::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !decltype( is_arithmetic( not_arithmetic_t() ) )::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/lazy_disable_if_c.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/lazy_disable_if_c.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,49 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+template< class T >
+struct static_assert_if_not_arithmetic
+ : boost::mpl::true_
+{
+ static_assert( boost::is_arithmetic< T >::value
+ , "Lazy type is incorrectly instantiated."
+ );
+};
+
+boost::mpl::false_ is_arithmetic( ... );
+
+template< class T
+ , BOOST_LAZY_DISABLE_IF_C
+ ( !boost::is_arithmetic< T >::value
+ , ( ResultType, typename static_assert_if_not_arithmetic< T >::type )
+ , ( DefaultParamType
+ , typename static_assert_if_not_arithmetic< T >::type
+ )
+ )
+ >
+ResultType is_arithmetic( T, DefaultParamType = DefaultParamType() );
+
+struct not_arithmetic_t {};
+
+static_assert( decltype( is_arithmetic( 1 ) )::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( decltype( is_arithmetic( 1. ) )::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !decltype( is_arithmetic( not_arithmetic_t() ) )::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/lazy_enable_if.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/lazy_enable_if.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,49 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+template< class T >
+struct static_assert_if_not_arithmetic
+ : boost::mpl::true_
+{
+ static_assert( boost::is_arithmetic< T >::value
+ , "Lazy type is incorrectly instantiated."
+ );
+};
+
+boost::mpl::false_ is_arithmetic( ... );
+
+template< class T
+ , BOOST_LAZY_ENABLE_IF
+ ( boost::is_arithmetic< T >
+ , ( ResultType, typename static_assert_if_not_arithmetic< T >::type )
+ , ( DefaultParamType
+ , typename static_assert_if_not_arithmetic< T >::type
+ )
+ )
+ >
+ResultType is_arithmetic( T, DefaultParamType = DefaultParamType() );
+
+struct not_arithmetic_t {};
+
+static_assert( decltype( is_arithmetic( 1 ) )::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( decltype( is_arithmetic( 1. ) )::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !decltype( is_arithmetic( not_arithmetic_t() ) )::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/lazy_enable_if_c.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/lazy_enable_if_c.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,49 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+template< class T >
+struct static_assert_if_not_arithmetic
+ : boost::mpl::true_
+{
+ static_assert( boost::is_arithmetic< T >::value
+ , "Lazy type is incorrectly instantiated."
+ );
+};
+
+boost::mpl::false_ is_arithmetic( ... );
+
+template< class T
+ , BOOST_LAZY_ENABLE_IF_C
+ ( boost::is_arithmetic< T >::value
+ , ( ResultType, typename static_assert_if_not_arithmetic< T >::type )
+ , ( DefaultParamType
+ , typename static_assert_if_not_arithmetic< T >::type
+ )
+ )
+ >
+ResultType is_arithmetic( T, DefaultParamType = DefaultParamType() );
+
+struct not_arithmetic_t {};
+
+static_assert( decltype( is_arithmetic( 1 ) )::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( decltype( is_arithmetic( 1. ) )::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !decltype( is_arithmetic( not_arithmetic_t() ) )::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/lazy_enable_if_expr.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/lazy_enable_if_expr.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,50 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <utility>
+
+
+template< class T >
+struct error_if_not_has_plus
+ : boost::mpl::true_
+{
+ typedef decltype( std::declval< T >() + std::declval< T >() ) error;
+};
+
+
+boost::mpl::false_ has_plus( ... );
+
+template< class T
+ , BOOST_LAZY_ENABLE_IF_EXPR
+ ( std::declval< T >() + std::declval< T >()
+ , ( ResultType, typename error_if_not_has_plus< T >::type )
+ , ( DefaultParamType, typename error_if_not_has_plus< T >::type )
+ )
+ >
+ResultType has_plus( T, DefaultParamType = DefaultParamType() );
+
+struct has_plus_t {};
+
+void operator +( has_plus_t const&, has_plus_t const& );
+
+struct no_plus_t {};
+
+static_assert( decltype( has_plus( 1 ) )::value
+ , "int incorrectly detected as not having plus."
+ );
+
+static_assert( decltype( has_plus( has_plus_t() ) )::value
+ , "has_plus_t incorrectly detected as not having plus."
+ );
+
+static_assert( !decltype( has_plus( no_plus_t() ) )::value
+ , "no_plus_t incorrectly detected as having plus."
+ );

Added: sandbox/enable_if/libs/enable_if/test/lazy_enable_if_expr_seq.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/lazy_enable_if_expr_seq.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,66 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <utility>
+
+
+template< class T >
+struct error_if_not_has_plus_and_minus
+ : boost::mpl::true_
+{
+ typedef decltype( std::declval< T >() + std::declval< T >() ) error_plus;
+ typedef decltype( std::declval< T >() - std::declval< T >() ) error_minus;
+};
+
+
+boost::mpl::false_ has_plus_and_minus( ... );
+
+template< class T
+ , BOOST_LAZY_ENABLE_IF_EXPR
+ ( ( std::declval< T >() + std::declval< T >() )
+ ( std::declval< T >() - std::declval< T >() )
+ , ( ResultType, typename error_if_not_has_plus_and_minus< T >::type )
+ , ( DefaultParamType
+ , typename error_if_not_has_plus_and_minus< T >::type
+ )
+ )
+ >
+ResultType has_plus_and_minus( T, DefaultParamType = DefaultParamType() );
+
+struct has_plus_t {};
+
+void operator +( has_plus_t const&, has_plus_t const& );
+
+struct has_minus_t {};
+
+void operator -( has_minus_t const&, has_minus_t const& );
+
+struct has_plus_and_minus_t {};
+
+void operator +( has_plus_and_minus_t const&, has_plus_and_minus_t const& );
+void operator -( has_plus_and_minus_t const&, has_plus_and_minus_t const& );
+
+static_assert( decltype( has_plus_and_minus( 1 ) )::value
+ , "int incorrectly detected as not having plus and minus"
+ );
+
+static_assert( !decltype( has_plus_and_minus( has_plus_t() ) )::value
+ , "has_plus_t incorrectly detected as having plus and minus"
+ );
+
+static_assert( !decltype( has_plus_and_minus( has_minus_t() ) )::value
+ , "has_minus_t incorrectly detected as having plus and minus"
+ );
+
+static_assert
+( decltype( has_plus_and_minus( has_plus_and_minus_t() ) )::value
+, "has_plus_and_minus_t incorrectly detected as not having plus and minus"
+);

Added: sandbox/enable_if/libs/enable_if/test/type_disable_if.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/type_disable_if.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,38 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+template< class T, class = void >
+struct is_arithmetic : boost::mpl::false_ {};
+
+template< class T >
+struct is_arithmetic
+ < T, BOOST_TYPE_DISABLE_IF
+ ( boost::mpl::not_< boost::is_arithmetic< T > > )
+ >
+ : boost::mpl::true_ {};
+
+struct not_arithmetic_t {};
+
+static_assert( is_arithmetic< int >::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( is_arithmetic< double >::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !is_arithmetic< not_arithmetic_t >::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/type_disable_if_c.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/type_disable_if_c.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,35 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+template< class T, class = void >
+struct is_arithmetic : boost::mpl::false_ {};
+
+template< class T >
+struct is_arithmetic
+ < T, BOOST_TYPE_DISABLE_IF_C( !boost::is_arithmetic< T >::value ) >
+ : boost::mpl::true_ {};
+
+struct not_arithmetic_t {};
+
+static_assert( is_arithmetic< int >::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( is_arithmetic< double >::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !is_arithmetic< not_arithmetic_t >::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/type_enable_if.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/type_enable_if.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,35 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+template< class T, class = void >
+struct is_arithmetic : boost::mpl::false_ {};
+
+template< class T >
+struct is_arithmetic
+ < T, BOOST_TYPE_ENABLE_IF( boost::is_arithmetic< T > ) >
+ : boost::mpl::true_ {};
+
+struct not_arithmetic_t {};
+
+static_assert( is_arithmetic< int >::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( is_arithmetic< double >::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !is_arithmetic< not_arithmetic_t >::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/type_enable_if_c.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/type_enable_if_c.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,35 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <utility>
+
+template< class T, class = void >
+struct is_arithmetic : boost::mpl::false_ {};
+
+template< class T >
+struct is_arithmetic
+ < T, BOOST_TYPE_ENABLE_IF_C( boost::is_arithmetic< T >::value ) >
+ : boost::mpl::true_ {};
+
+struct not_arithmetic_t {};
+
+static_assert( is_arithmetic< int >::value
+ , "int incorrectly detected as not being arithmetic."
+ );
+
+static_assert( is_arithmetic< double >::value
+ , "double incorrectly detected as not being arithmetic."
+ );
+
+static_assert( !is_arithmetic< not_arithmetic_t >::value
+ , "not_arithmetic_t incorrectly detected as begin arithmetic."
+ );

Added: sandbox/enable_if/libs/enable_if/test/type_enable_if_expr.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/type_enable_if_expr.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,44 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <utility>
+
+template< class T, class = void >
+struct has_plus : boost::mpl::false_ {};
+
+template< class T >
+struct has_plus
+ < T
+ , BOOST_TYPE_ENABLE_IF_EXPR
+ ( std::declval< T >() + std::declval< T >() )
+ > : boost::mpl::true_ {};
+
+struct has_plus_t {};
+
+void operator +( has_plus_t const&, has_plus_t const& );
+
+struct no_plus_t {};
+
+static_assert( !has_plus< void >::value
+ , "void incorrectly detected as having plus."
+ );
+
+static_assert( has_plus< int >::value
+ , "int incorrectly detected as not having plus."
+ );
+
+static_assert( has_plus< has_plus_t >::value
+ , "has_plus_t incorrectly detected as having plus."
+ );
+
+static_assert( !has_plus< no_plus_t >::value
+ , "no_plus_t incorrectly detected as having plus."
+ );

Added: sandbox/enable_if/libs/enable_if/test/type_enable_if_expr_seq.cpp
==============================================================================
--- (empty file)
+++ sandbox/enable_if/libs/enable_if/test/type_enable_if_expr_seq.cpp 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,58 @@
+/*==============================================================================
+ Copyright (c) 2012 Matt Calabrese
+
+ Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/utility/enable_if_macros.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <utility>
+
+template< class T, class = void >
+struct has_plus_and_minus : boost::mpl::false_ {};
+
+template< class T >
+struct has_plus_and_minus
+ < T
+ , BOOST_TYPE_ENABLE_IF_EXPR
+ ( ( std::declval< T >() + std::declval< T >() )
+ ( std::declval< T >() - std::declval< T >() )
+ )
+ > : boost::mpl::true_ {};
+
+struct has_plus_t {};
+
+void operator +( has_plus_t const&, has_plus_t const& );
+
+struct has_minus_t {};
+
+void operator -( has_minus_t const&, has_minus_t const& );
+
+struct has_plus_and_minus_t {};
+
+void operator +( has_plus_and_minus_t const&, has_plus_and_minus_t const& );
+void operator -( has_plus_and_minus_t const&, has_plus_and_minus_t const& );
+
+static_assert( !has_plus_and_minus< void >::value
+ , "void incorrectly detected as having plus and minus"
+ );
+
+static_assert( has_plus_and_minus< int >::value
+ , "int incorrectly detected as not having plus and minus"
+ );
+
+static_assert( !has_plus_and_minus< has_plus_t >::value
+ , "has_plus_t incorrectly detected as having plus and minus"
+ );
+
+static_assert( !has_plus_and_minus< has_minus_t >::value
+ , "has_minus_t incorrectly detected as having plus and minus"
+ );
+
+static_assert
+( has_plus_and_minus< has_plus_and_minus_t >::value
+, "has_plus_and_minus_t incorrectly detected as not having plus and minus"
+);

Added: sandbox/enable_if/project-root.jam
==============================================================================
--- (empty file)
+++ sandbox/enable_if/project-root.jam 2012-10-04 16:47:06 EDT (Thu, 04 Oct 2012)
@@ -0,0 +1,17 @@
+#
+# Copyright (c) 2012 Matthew Calabrese
+#
+# 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)
+#
+
+path-constant top : . ;
+path-constant sandbox : .. ;
+
+import modules ;
+import path ;
+
+path-constant boost-root : [ modules.peek : BOOST_ROOT ] ;
+path-constant boost-enable_if-include : $(top)/include ;
+path-constant boost-vmd-include : $(sandbox)/variadic_macro_data ;


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