Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66409 - in sandbox/auto_function: . boost boost/auto_function boost/auto_function/detail libs libs/auto_function libs/auto_function/doc libs/auto_function/doc/boost_auto_function libs/auto_function/doc/preface libs/auto_function/doc/tutorials libs/auto_function/example libs/auto_function/example/first libs/auto_function/example/multi_cast libs/auto_function/test
From: rivorus_at_[hidden]
Date: 2010-11-06 05:35:47


Author: matt_calabrese
Date: 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
New Revision: 66409
URL: http://svn.boost.org/trac/boost/changeset/66409

Log:
Boost.Auto_Function initial commit
Added:
   sandbox/auto_function/
   sandbox/auto_function/boost/
   sandbox/auto_function/boost/auto_function/
   sandbox/auto_function/boost/auto_function.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/auto_function.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/basic_auto_function.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/
   sandbox/auto_function/boost/auto_function/detail/128_args.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/arg_of_category.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/args_to_sequence.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/error.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/error_info.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/head_argument.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/is_conditional_arg.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/is_parenthesized.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/is_recognized_arg.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/is_valid_name_and_params.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/num_args.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/param.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/param_id.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/param_id_category.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/param_id_category_value.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/param_id_implies_parentheses.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/param_id_value.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/param_templates.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/rescan.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/split_param_id_and_param.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/tail_arguments.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/detail/variadic_cat.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/limits.hpp (contents, props changed)
   sandbox/auto_function/boost/auto_function/support.hpp (contents, props changed)
   sandbox/auto_function/libs/
   sandbox/auto_function/libs/auto_function/
   sandbox/auto_function/libs/auto_function/doc/
   sandbox/auto_function/libs/auto_function/doc/Jamfile (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/acknowledgements.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/auto_function.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/boost_auto_function/
   sandbox/auto_function/libs/auto_function/doc/boost_auto_function.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/boost_auto_function/combining_do_and_explicit.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/boost_auto_function/named_parameters.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/boost_auto_function/overview.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/boost_auto_function/separating_declaration_from_implementation.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/boost_basic_auto_function.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/checking_support.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/future_direction.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/preface/
   sandbox/auto_function/libs/auto_function/doc/preface.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/preface/description.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/preface/motivation.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/rationale.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/support.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/tutorials/
   sandbox/auto_function/libs/auto_function/doc/tutorials.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/tutorials/first.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/tutorials/last.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/doc/tutorials/multi_cast.qbk (contents, props changed)
   sandbox/auto_function/libs/auto_function/example/
   sandbox/auto_function/libs/auto_function/example/first/
   sandbox/auto_function/libs/auto_function/example/first/auto_function_first.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/example/first/basic_auto_function_first.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/example/first/no_auto_function_first.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/example/multi_cast/
   sandbox/auto_function/libs/auto_function/example/multi_cast/auto_function_multi_cast.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/example/multi_cast/basic_auto_function_multi_cast.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/example/multi_cast/no_auto_function_multi_cast.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/example/square.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/
   sandbox/auto_function/libs/auto_function/test/Jamfile (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_auto_if.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_auto_not.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_combinations.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_do.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_do_and_explicit.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_explicit.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_if.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_multiple_of_same_category.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_not.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_return.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_return_ref.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_return_rvalue_ref.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_return_value.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_try.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_virtual_explicit.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/auto_function_void.cpp (contents, props changed)
   sandbox/auto_function/libs/auto_function/test/basic_auto_function.cpp (contents, props changed)

Added: sandbox/auto_function/boost/auto_function.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,17 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_HPP
+#define BOOST_AUTO_FUNCTION_HPP
+
+#include <boost/auto_function/auto_function.hpp>
+#include <boost/auto_function/basic_auto_function.hpp>
+#include <boost/auto_function/limits.hpp>
+#include <boost/auto_function/support.hpp>
+
+#endif

Added: sandbox/auto_function/boost/auto_function/auto_function.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/auto_function.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,309 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_AUTO_FUNCTION_HPP
+#define BOOST_AUTO_FUNCTION_AUTO_FUNCTION_HPP
+
+#include <boost/auto_function/detail/error.hpp>
+#include <boost/auto_function/support.hpp>
+#include <boost/config.hpp>
+
+#ifndef BOOST_NO_BOOST_AUTO_FUNCTION
+
+#include <boost/auto_function/detail/arg_of_category.hpp>
+#include <boost/auto_function/detail/error_info.hpp>
+#include <boost/auto_function/detail/is_conditional_arg.hpp>
+#include <boost/auto_function/detail/num_args.hpp>
+#include <boost/auto_function/detail/param_id_category.hpp>
+#include <boost/auto_function/detail/param_templates.hpp>
+#include <boost/auto_function/detail/rescan.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/seq/elem.hpp>
+#include <boost/preprocessor/seq/for_each.hpp>
+#include <boost/preprocessor/seq/seq.hpp>
+#include <boost/preprocessor/seq/size.hpp>
+#include <boost/preprocessor/tuple/to_seq.hpp>
+
+// ToDo: Possibly make auto constructor macro
+
+// Requires at least 2 parameters
+#define BOOST_AUTO_FUNCTION( function_name_and_params_in_parentheses, ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_IMPL \
+( BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO \
+ ( function_name_and_params_in_parentheses, __VA_ARGS__ ) \
+, function_name_and_params_in_parentheses, __VA_ARGS__ \
+)
+
+// This macro is variadic in order to directly support operator,
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL( errors, ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_EMIT_ERRORS( errors ) \
+BOOST_PP_IIF( BOOST_AUTO_FUNCTION_DETAIL_HAS_ERRORS( errors ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_IMPL_ON_ERROR \
+ , BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS \
+ )( __VA_ARGS__ )
+
+// When he have an error that's detected during preprocessing don't do anything
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_ON_ERROR( ... )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_FUN_NAME_AND_PARAMS( ... ) \
+auto __VA_ARGS__ ->
+
+#define BOOST_AUTO_FUNCTION_DETAIL_UNCHECKED_RETURN_TYPE( ... ) \
+BOOST_PP_IIF \
+( BOOST_AUTO_FUNCTION_DETAIL_HAS_ARG_OF_CATEGORY( explicit, __VA_ARGS__ ) \
+, BOOST_PP_IIF \
+ ( BOOST_AUTO_FUNCTION_DETAIL_HAS_ARG_OF_CATEGORY( do, __VA_ARGS__ ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_UNCHECKED_EXPLICIT_DO \
+ , BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_UNCHECKED_EXPLICIT \
+ ) \
+, BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_UNCHECKED_DO \
+)( __VA_ARGS__ )
+
+// Branch out to different implementations depending on what's present
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS( fun_name_and_params, ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_IMPL_FUN_NAME_AND_PARAMS fun_name_and_params \
+BOOST_PP_IIF \
+( BOOST_AUTO_FUNCTION_DETAIL_HAS_ARG_OF_CATEGORY( explicit, __VA_ARGS__ ) \
+, BOOST_PP_IIF \
+ ( BOOST_AUTO_FUNCTION_DETAIL_HAS_ARG_OF_CATEGORY( do, __VA_ARGS__ ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_EXPLICIT_AND_DO \
+ , BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_EXPLICIT \
+ ) \
+, BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_DO \
+)( __VA_ARGS__ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_EXPLICIT_TYPE( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_RESCAN \
+( BOOST_PP_CAT \
+ ( BOOST_AUTO_FUNCTION_DETAIL_IMPL_EXPLICIT_TYPE_ \
+ , BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_PARAM_ID( explicit \
+ , __VA_ARGS__ \
+ ) \
+ ) \
+ BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY( explicit, __VA_ARGS__ ) \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_EXPLICIT_TYPE_auto_explicit(return_type\
+ , ... \
+ ) \
+decltype \
+( ::boost::auto_function::detail::impl_auto_explicit_type \
+ < return_type, __VA_ARGS__ >() \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_EXPLICIT_TYPE_explicit( ... ) \
+decltype \
+( ::boost::auto_function::detail::impl_explicit_type< __VA_ARGS__ >() )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_EXPLICIT_TYPE_virtual_explicit( ... ) \
+decltype \
+( ::boost::auto_function::detail::impl_virtual_explicit_type< __VA_ARGS__ >() )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_RESCAN \
+( BOOST_PP_CAT \
+ ( BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE_ \
+ , BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_PARAM_ID( do, __VA_ARGS__ ) \
+ ) BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY( do, __VA_ARGS__ ) \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_BODY( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_RESCAN \
+( BOOST_PP_CAT \
+ ( BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_BODY_ \
+ , BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_PARAM_ID( do, __VA_ARGS__ ) \
+ ) BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY( do, __VA_ARGS__ ) \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE_do( ... ) \
+decltype( [&]{ __VA_ARGS__ }() )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE_return( ... ) \
+decltype( __VA_ARGS__ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE_return_ref( ... ) \
+decltype( __VA_ARGS__ )&
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE_return_rvalue_ref( ... ) \
+decltype( __VA_ARGS__ )&&
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE_return_value( ... ) \
+decltype( ::boost::auto_function::detail::impl_return_value_type \
+ < decltype( __VA_ARGS__ ) >() \
+ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE_void( ... ) \
+decltype( ::boost::auto_function::detail::impl_return_void_type \
+ < decltype( __VA_ARGS__ ) >() \
+ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_BODY_do( ... ) __VA_ARGS__
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_BODY_return( ... ) \
+return __VA_ARGS__;
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_BODY_return_ref( ... ) \
+return static_cast< decltype( __VA_ARGS__ )& >( __VA_ARGS__ );
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_BODY_return_rvalue_ref( ... ) \
+return static_cast< decltype( __VA_ARGS__ )&& >( __VA_ARGS__ );
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_BODY_return_value( ... ) \
+return __VA_ARGS__;
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_BODY_void( ... ) __VA_ARGS__;
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_UNCHECKED_EXPLICIT( ... ) \
+decltype( ::boost::auto_function::detail::impl_explicit \
+ < BOOST_AUTO_FUNCTION_DETAIL_IMPL_EXPLICIT_TYPE( __VA_ARGS__ ) \
+ , void \
+ >() \
+ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_UNCHECKED_DO( ... ) \
+decltype( ::boost::auto_function::detail::impl_do \
+ < BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE( __VA_ARGS__ ) \
+ , void \
+ >() \
+ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_UNCHECKED_EXPLICIT_DO( ... ) \
+decltype( ::boost::auto_function::detail::impl_explicit_and_do \
+ < BOOST_AUTO_FUNCTION_DETAIL_IMPL_EXPLICIT_TYPE( __VA_ARGS__ ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE( __VA_ARGS__ ) \
+ , void \
+ >() \
+ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_EXPLICIT( ... ) \
+decltype( ::boost::auto_function::detail::impl_explicit \
+ < BOOST_AUTO_FUNCTION_DETAIL_IMPL_EXPLICIT_TYPE( __VA_ARGS__ ) \
+ , ::boost::auto_function::detail::types \
+ < BOOST_AUTO_FUNCTION_DETAIL_IMPL_CONDITIONAL_ARGS \
+ ( BOOST_AUTO_FUNCTION_DETAIL_UNCHECKED_RETURN_TYPE( __VA_ARGS__ )\
+ , __VA_ARGS__ \
+ ) \
+ void \
+ > \
+ >() \
+ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_DO( ... ) \
+decltype( ::boost::auto_function::detail::impl_do \
+ < BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE( __VA_ARGS__ ) \
+ , ::boost::auto_function::detail::types \
+ < BOOST_AUTO_FUNCTION_DETAIL_IMPL_CONDITIONAL_ARGS \
+ ( BOOST_AUTO_FUNCTION_DETAIL_UNCHECKED_RETURN_TYPE( __VA_ARGS__ )\
+ , __VA_ARGS__ \
+ ) \
+ void \
+ > \
+ >() \
+ ) { BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_BODY( __VA_ARGS__ ) }
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_NO_ERRORS_EXPLICIT_AND_DO( ... ) \
+decltype( ::boost::auto_function::detail::impl_explicit_and_do \
+ < BOOST_AUTO_FUNCTION_DETAIL_IMPL_EXPLICIT_TYPE( __VA_ARGS__ ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_TYPE( __VA_ARGS__ ) \
+ , ::boost::auto_function::detail::types \
+ < BOOST_AUTO_FUNCTION_DETAIL_IMPL_CONDITIONAL_ARGS \
+ ( BOOST_AUTO_FUNCTION_DETAIL_UNCHECKED_RETURN_TYPE( __VA_ARGS__ )\
+ , __VA_ARGS__ \
+ ) \
+ void \
+ > \
+ >() \
+ ) { BOOST_AUTO_FUNCTION_DETAIL_IMPL_DO_BODY( __VA_ARGS__ ) }
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_CONDITIONAL_ARGS( return_type, ... ) \
+BOOST_PP_SEQ_FOR_EACH \
+( BOOST_AUTO_FUNCTION_DETAIL_IMPL_CONDITIONAL_ARGS_MACRO \
+, return_type \
+, BOOST_PP_TUPLE_TO_SEQ( BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS( __VA_ARGS__ ) \
+ , ( __VA_ARGS__ ) \
+ ) \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_EAT_ARGS( ... )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_IMPL( return_type, arg ) \
+BOOST_PP_CAT( BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_ \
+ , BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID( arg ) \
+ )( return_type, BOOST_AUTO_FUNCTION_DETAIL_PARAM( arg ) )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IMPL_CONDITIONAL_ARGS_MACRO( r, return_type \
+ , elem \
+ ) \
+BOOST_PP_IIF \
+( BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG( elem ) \
+, BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_IMPL \
+, BOOST_AUTO_FUNCTION_DETAIL_EAT_ARGS \
+)( return_type, elem )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_auto_if( return_type, ... )\
+decltype \
+( ::boost::auto_function::detail::perform_auto_if_check \
+ < return_type, bool ( __VA_ARGS__ ) >() \
+),
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_auto_not( return_type,... )\
+decltype \
+( ::boost::auto_function::detail::perform_auto_not_check \
+ < return_type, bool ( __VA_ARGS__ ) >() \
+),
+
+// ToDo: Define (requires lambda trick)
+#define BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_auto_try( return_type,... )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_if( return_type, ... ) \
+decltype \
+( ::boost::auto_function::detail:: \
+your_if_condition_isnt_dependent_on_a_function_template_argument \
+< bool ( __VA_ARGS__ ) >() \
+),
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_not( return_type, ... ) \
+decltype \
+( ::boost::auto_function::detail:: \
+your_not_condition_isnt_dependent_on_a_function_template_argument \
+< bool ( __VA_ARGS__ ) >() \
+),
+
+// ToDo: Make this a preprocess sequence for each and change the top level loop
+// to be a repeat (sequence for each can't nest)
+#define BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_try( return_type, seq ) \
+BOOST_PP_REPEAT( BOOST_PP_SEQ_SIZE( seq ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_TRY_MACRO \
+ , seq \
+ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CONDITIONAL_ARGS_TRY_MACRO( z, n, seq ) \
+decltype( BOOST_PP_SEQ_ELEM( n, seq ) ),
+
+#else // Else, BOOST_AUTO_FUNCTION is not supported
+
+#ifndef BOOST_NO_VARIADIC_MACROS // If variadic macros are supported
+
+// Output an error when BOOST_AUTO_FUNCTION is used when it is not supported
+#define BOOST_AUTO_FUNCTION( function_name_and_params_in_parentheses, ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR();
+
+#else // Else, variadic macros aren't supported
+
+// Output an error when BOOST_AUTO_FUNCTION is used when it is not supported
+#define BOOST_AUTO_FUNCTION \
+BOOST_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR();
+
+#endif // End check for variadic macro support
+
+#endif // Ends check for BOOST_AUTO_FUNCTION support
+
+#endif // BOOST_AUTO_FUNCTION_AUTO_FUNCTION_HPP

Added: sandbox/auto_function/boost/auto_function/basic_auto_function.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/basic_auto_function.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,57 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_BASIC_AUTO_FUNCTION_HPP
+#define BOOST_AUTO_FUNCTION_BASIC_AUTO_FUNCTION_HPP
+
+#include <boost/auto_function/support.hpp>
+
+// If BOOST_BASIC_AUTO_FUNCTION is supported
+#ifndef BOOST_NO_BOOST_BASIC_AUTO_FUNCTION
+
+#include <boost/auto_function/auto_function.hpp>
+
+#define BOOST_BASIC_AUTO_FUNCTION( ... ) \
+BOOST_AUTO_FUNCTION( ( __VA_ARGS__ ), BOOST_BASIC_AUTO_FUNCTION_DETAIL_IMPL
+
+// Takes the function body as a parameter
+#define BOOST_BASIC_AUTO_FUNCTION_DETAIL_IMPL( ... ) ( do __VA_ARGS__ ) )
+
+#else // Else, BOOST_BASIC_AUTO_FUNCTION is not supported
+
+#include <boost/auto_function/detail/error.hpp>
+
+#ifndef BOOST_NO_VARIADIC_MACROS // If variadic macros are supported
+
+// Output an error when BOOST_AUTO_FUNCTION is used when it is not supported
+#define BOOST_BASIC_AUTO_FUNCTION( ... ) \
+void __VA_ARGS__; BOOST_BASIC_AUTO_FUNCTION_DETAIL_IMPL
+
+#define BOOST_BASIC_AUTO_FUNCTION_DETAIL_IMPL( ... ) \
+BOOST_BASIC_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR();
+
+#else // Else, variadic macros aren't supported
+
+#include <boost/preprocessor/cat.hpp>
+
+// Output an error when BOOST_AUTO_FUNCTION is used when it is not supported
+#define BOOST_BASIC_AUTO_FUNCTION \
+void BOOST_PP_CAT( dummy_fun_, __LINE__ ); \
+BOOST_BASIC_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR(); \
+BOOST_BASIC_AUTO_FUNCTION_DETAIL_TRY_EAT_TWICE
+
+#define BOOST_BASIC_AUTO_FUNCTION_DETAIL_TRY_EAT_TWICE( arg ) \
+BOOST_BASIC_AUTO_FUNCTION_DETAIL_TRY_EAT
+
+#define BOOST_BASIC_AUTO_FUNCTION_DETAIL_TRY_EAT( arg )
+
+#endif // End check for variadic macro support
+
+#endif // End BOOST_BASIC_AUTO_FUNCTION support check
+
+#endif // BOOST_AUTO_FUNCTION_BASIC_AUTO_FUNCTION_HPP

Added: sandbox/auto_function/boost/auto_function/detail/128_args.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/128_args.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,42 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_128_ARGS_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_128_ARGS_HPP
+
+// Yields 128 comma-separated tokens
+#define BOOST_AUTO_FUNCTION_DETAIL_128_ARGS() \
+ _00,_01,_02,_03,_04,_05,_06,_07,_08,_09,_0a,_0b,_0c,_0d,_0e,_0f \
+,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a,_1b,_1c,_1d,_1e,_1f \
+,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_2a,_2b,_2c,_2d,_2e,_2f \
+,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_3a,_3b,_3c,_3d,_3e,_3f \
+,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_4a,_4b,_4c,_4d,_4e,_4f \
+,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_5a,_5b,_5c,_5d,_5e,_5f \
+,_60,_61,_62,_63,_64,_65,_66,_67,_68,_69,_6a,_6b,_6c,_6d,_6e,_6f \
+,_70,_71,_72,_73,_74,_75,_76,_77,_78,_79,_7a,_7b,_7c,_7d,_7e,_7f
+
+// Yields 256 comma-separated tokens
+#define BOOST_AUTO_FUNCTION_DETAIL_256_ARGS() \
+ _00,_01,_02,_03,_04,_05,_06,_07,_08,_09,_0a,_0b,_0c,_0d,_0e,_0f \
+,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a,_1b,_1c,_1d,_1e,_1f \
+,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_2a,_2b,_2c,_2d,_2e,_2f \
+,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_3a,_3b,_3c,_3d,_3e,_3f \
+,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_4a,_4b,_4c,_4d,_4e,_4f \
+,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_5a,_5b,_5c,_5d,_5e,_5f \
+,_60,_61,_62,_63,_64,_65,_66,_67,_68,_69,_6a,_6b,_6c,_6d,_6e,_6f \
+,_70,_71,_72,_73,_74,_75,_76,_77,_78,_79,_7a,_7b,_7c,_7d,_7e,_7f \
+,_80,_81,_82,_83,_84,_85,_86,_87,_88,_89,_8a,_8b,_8c,_8d,_8e,_8f \
+,_90_,11,_92,_93,_94,_95,_96,_97,_98,_99,_9a,_9b,_9c,_9d,_9e,_9f \
+,_a0,_a1,_a2,_a3,_a4,_a5,_a6,_a7,_a8,_a9,_aa,_ab,_ac,_ad,_ae,_af \
+,_b0,_b1,_b2,_b3,_b4,_b5,_b6,_b7,_b8,_b9,_ba,_bb,_bc,_bd,_be,_bf \
+,_c0,_c1,_c2,_c3,_c4,_c5,_c6,_c7,_c8,_c9,_ca,_cb,_cc,_cd,_ce,_cf \
+,_d0,_d1,_d2,_d3,_d4,_d5,_d6,_d7,_d8,_d9,_da,_db,_dc,_dd,_de,_df \
+,_e0,_e1,_e2,_e3,_e4,_e5,_e6,_e7,_e8,_e9,_ea,_eb,_ec,_ed,_ee,_ef \
+,_f0,_f1,_f2,_f3,_f4,_f5,_f6,_f7,_f8,_f9,_fa,_fb,_fc,_fd,_fe,_ff
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_128_ARGS_HPP

Added: sandbox/auto_function/boost/auto_function/detail/arg_of_category.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/arg_of_category.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,88 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_HPP
+
+#include <boost/auto_function/detail/param.hpp>
+#include <boost/auto_function/detail/param_id.hpp>
+#include <boost/auto_function/detail/param_id_category_value.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/seq/elem.hpp>
+#include <boost/preprocessor/seq/fold_left.hpp>
+#include <boost/preprocessor/seq/seq.hpp>
+#include <boost/preprocessor/seq/size.hpp>
+#include <boost/preprocessor/tuple/to_seq.hpp>
+
+// Yields 1 if an argument of the given category was passed
+#define BOOST_AUTO_FUNCTION_DETAIL_HAS_ARG_OF_CATEGORY( param_category \
+ , ... \
+ ) \
+BOOST_PP_EQUAL \
+( BOOST_PP_SEQ_SIZE \
+ ( BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_IMPL( param_category \
+ , __VA_ARGS__ \
+ ) \
+ ) \
+, 2 \
+)
+
+// Yields a parenthesized version of the parameter passed, without the ID
+#define BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY( param_category \
+ , ... \
+ ) \
+BOOST_PP_SEQ_ELEM \
+( 1, BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_IMPL( param_category \
+ , __VA_ARGS__ \
+ ) \
+)
+
+// Yields the parameter ID of the argument that matches the desired category
+#define BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_PARAM_ID( param_category \
+ , ... \
+ ) \
+BOOST_PP_SEQ_HEAD \
+( BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_IMPL( param_category \
+ , __VA_ARGS__ \
+ ) \
+)
+
+// Yields a 2 element sequence of the form (param_id)((param))
+#define BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_IMPL( param_category \
+ , ... \
+ ) \
+BOOST_PP_SEQ_FOLD_LEFT \
+( BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_MACRO \
+, ( param_category ) \
+, BOOST_PP_TUPLE_TO_SEQ( BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS( __VA_ARGS__ ) \
+ , ( __VA_ARGS__ ) \
+ ) \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_NOT_YET_FOUND( state, elem )\
+BOOST_PP_IIF \
+( BOOST_PP_EQUAL \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE( state ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE( elem ) \
+ ) \
+, ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID( elem ) ) \
+ ( ( BOOST_AUTO_FUNCTION_DETAIL_PARAM( elem ) ) ) \
+, state \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_FOUND( state, elem ) state
+
+#define BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_MACRO( s, state, elem ) \
+BOOST_PP_IIF \
+( BOOST_PP_EQUAL( BOOST_PP_SEQ_SIZE( state ), 2 ) \
+, BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_FOUND \
+, BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_NOT_YET_FOUND \
+)( state, elem )
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_ARG_OF_CATEGORY_HPP

Added: sandbox/auto_function/boost/auto_function/detail/args_to_sequence.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/args_to_sequence.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,20 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_ARGS_TO_SEQUENCE_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_ARGS_TO_SEQUENCE_HPP
+
+#include <boost/auto_function/detail/num_args.hpp>
+#include <boost/preprocessor/tuple/to_seq.hpp>
+
+#define BOOST_AUTO_FUNCTION_DETAIL_ARGS_TO_SEQUENCE( ... ) \
+BOOST_PP_TUPLE_TO_SEQ( BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS( __VA_ARGS__ ) \
+ , ( __VA_ARGS__ ) \
+ )
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_ARGS_TO_SEQUENCE_HPP

Added: sandbox/auto_function/boost/auto_function/detail/error.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/error.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,275 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_ERROR_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_HPP
+
+#include <boost/config.hpp>
+#include <boost/auto_function/detail/param_id.hpp>
+#include <boost/auto_function/support.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/stringize.hpp>
+
+#ifndef BOOST_NO_STATIC_ASSERT // If static_assert is supported
+
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR( string_, identifier_ ) \
+static_assert( false, string_ )
+
+#else // Else, static_assert isn't supported so use BOOST_MPL_ASSERT_MSG
+
+#include <boost/mpl/assert.hpp>
+
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR( string_, identifier_ ) \
+BOOST_MPL_ASSERT_MSG( false, identifier_, () )
+
+#endif // End check for static_assert support
+
+#ifndef BOOST_NO_BOOST_AUTO_FUNCTION // If BOOST_AUTO_FUNCTION is supported
+
+// Error if an argument isn't parenthesized
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_NOT_PARENTHESIZED( arg_num, line ) \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "Argument #" BOOST_PP_STRINGIZE( arg_num ) " of BOOST_AUTO_FUNCTION is not " \
+ "parenthesized: " BOOST_PP_STRINGIZE( line ) \
+, BOOST_PP_CAT \
+ ( BOOST_PP_CAT \
+ ( ARGUMENT_ \
+ , BOOST_PP_SEQ_ELEM( 0, data ) \
+ ) \
+ , _OF_BOOST_AUTO_FUNCTION_IS_NOT_PARENTHESIZED \
+ ) \
+)
+
+// Error if an argument's argument doesn't start with parentheses
+// This is used with try and auto try since they are required to take
+// preprocessor sequences
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_ARG_ARG_NOT_PAREN( id ) \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "A BOOST_AUTO_FUNCTION \"" \
+ BOOST_PP_STRINGIZE( BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID( id ) ) \
+ "\" argument should be a Boost.Preprocessor sequence of expressions" \
+, BOOST_PP_CAT \
+ ( BOOST_PP_CAT( A_BOOST_AUTO_FUNCTION_ \
+ , BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID( id ) \
+ ) \
+ , _ARGUMENT_SHOULD_BE_A_BOOST_PREPROCESSOR_SEQUENCE \
+ ) \
+)
+
+// Error if the function name and parameters are invalid
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_INVALID_NAME_AND_PARAMS() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "Invalid function name and parameters passed as the first argument to " \
+ "BOOST_AUTO_FUNCTION", \
+INVALID_FUNCTION_NAME_AND_PARAMS_PASSED_AS_THE_FIRST_ARG_TO_BOOST_AUTO_FUNCTION\
+)
+
+// Error when a parameter kind isn't supported
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_NO_PARAM_SUPPORT( id, argnum ) \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "BOOST_AUTO_FUNCTION \"" \
+ BOOST_PP_STRINGIZE( BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID( id ) ) \
+ "\" parameters are not supported with this compiler" \
+, BOOST_PP_CAT \
+ ( BOOST_PP_CAT( BOOST_AUTO_FUNCTION_ \
+ , BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID( id ) \
+ ) \
+ , _PARAMETERS_ARE_NOT_SUPPORTED_WITH_THIS_COMPILER \
+ ) \
+)
+
+// Error if "auto explicit" is used without a function body
+#define BOOST_AUTO_FUNCTION_DETAIL_AUTO_EXPLICIT_WITHOUT_BODY( arg_num, line ) \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "Cannot use \"auto explicit\" without a \"return\" or \"do\"" \
+, CANNOT_USE_AUTO_EXPLICIT_WITHOUT_A_RETURN_OR_DO \
+)
+
+// Error when multiple arguments of a particular category are encountered
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_MULTIPLE_OF_CATEGORY(cat,argnum,first)\
+BOOST_PP_CAT( BOOST_AUTO_FUNCTION_DETAIL_ERROR_MULTIPLE_, cat )( argnum, first )
+
+// Error if an unrecognized parameter ID is encountered
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_UNRECOGNIZED_PARAM_ID( arg_num, line )\
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "Unrecognized parameter ID used with argument #" \
+ BOOST_PP_STRINGIZE( arg_num ) \
+ " of BOOST_AUTO_FUNCTION: " BOOST_PP_STRINGIZE( line ) \
+, BOOST_PP_CAT \
+ ( BOOST_PP_CAT \
+ ( UNRECOGNIZED_PARAMETER_ID_USED_WITH_ARGUMENT_ \
+ , BOOST_PP_SEQ_ELEM( 0, data ) \
+ ) \
+ , _OF_BOOST_AUTO_FUNCTION \
+ ) \
+)
+
+// Error if break is specified without an explicit result type
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_END_WITHOUT_RESULT_TYPE() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "Cannot end a BOOST_AUTO_FUNCTION without a deducible result type " \
+ "(provide a function body with \"return\" or \"do\", or specify a result " \
+ "type with \"explicit\")" \
+, CANNOT_END_A_BOOST_AUTO_FUNCTION_WITHOUT_A_DEDUCIBLE_RESULT_TYPE \
+)
+
+// Error when multiple explicit result types are specified
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_MULTIPLE_explicit( arg_number, first )\
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "More than one \"explicit\" or \"virtual explicit\" specified for " \
+ "BOOST_AUTO_FUNCTION (argument #" BOOST_PP_STRINGIZE( arg_number ) \
+ " conflicts with argument #" BOOST_PP_STRINGIZE( first ) ")" \
+, MORE_THAN_ONE_EXPLICIT_OR_VIRTUAL_EXPLICIT_WITH_BOOST_AUTO_FUNCTION \
+)
+
+// Error when multiple if[_not] are specified
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_MULTIPLE_if( arg_number, first ) \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "More than one \"if\" or \"not\" specified for BOOST_AUTO_FUNCTION (argument"\
+ " #" BOOST_PP_STRINGIZE( arg_number ) " conflicts with argument # " \
+ BOOST_PP_STRINGIZE( arg_number ) "): To require multiple conditions, combine"\
+ " them together with && or ::boost::mpl::and_" \
+, MORE_THAN_ONE_IF_OR_NOT_WITH_BOOST_AUTO_FUNCTION \
+)
+
+// Error when multiple try are specified
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_MULTIPLE_try( arg_number, first ) \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "More than one \"try\" specified for BOOST_AUTO_FUNCTION: (argument #" \
+ BOOST_PP_STRINGIZE( arg_number ) " conflicts with argument #" \
+ BOOST_PP_STRINGIZE( first ) "): To require multiple expressions, use a " \
+ "Boost.Preprocessor sequence" \
+, MORE_THAN_ONE_TRY_WITH_BOOST_AUTO_FUNCTION \
+)
+
+// Error when multiple try are specified
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_MULTIPLE_auto_try( arg_number, first )\
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "More than one \"auto try\" specified for BOOST_AUTO_FUNCTION: (argument #" \
+ BOOST_PP_STRINGIZE( arg_number ) " conflicts with argument #" \
+ BOOST_PP_STRINGIZE( first ) "): To require multiple expressions, use a " \
+ "Boost.Preprocessor sequence" \
+, MORE_THAN_ONE_AUTO_TRY_WITH_BOOST_AUTO_FUNCTION \
+)
+
+// Error when multiple return type requirements are specified
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_MULTIPLE_auto_if(arg_number,first)\
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "More than one \"auto if\" or \"auto not\" specified for " \
+ "BOOST_AUTO_FUNCTION: (argument #" BOOST_PP_STRINGIZE( arg_number ) \
+ " conflicts with argument #" BOOST_PP_STRINGIZE( first ) "): To require " \
+ "multiple conditions for the return type, combine them together with " \
+ " ::boost::mpl::and_" \
+, MORE_THAN_ONE_AUTO_IF_OR_AUTO_NOT_WITH_BOOST_AUTO_FUNCTION \
+)
+
+// Error when multiple function bodies requirements are specified
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_MULTIPLE_do( arg_number, first ) \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "More than one function body specified for BOOST_AUTO_FUNCTION (argument #" \
+ BOOST_PP_STRINGIZE( arg_number ) " conflicts with argument #" \
+ BOOST_PP_STRINGIZE( first ) ")" \
+, MORE_THAN_ONE_FUNCTION_BODY_SPECIFIED_FOR_BOOST_AUTO_FUNCTION \
+)
+
+#else // Else, BOOST_AUTO_FUNCTION is not supported
+
+// Start a series of checks for why BOOST_AUTO_FUNCTION isn't supported
+#ifdef BOOST_NO_VARIADIC_MACROS
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "BOOST_AUTO_FUNCTION requires variadic macro support from the compiler" \
+, BOOST_AUTO_FUNCTION_REQUIRES_VARIADIC_MACRO_SUPPORT_FROM_THE_COMPILER \
+)
+
+#elif defined( BOOST_NO_TRAILING_RETURN_TYPE )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "BOOST_AUTO_FUNCTION requires trailing return type support from the compiler"\
+, BOOST_AUTO_FUNCTION_REQUIRES_TRAILING_RETURN_TYPE_SUPPORT_FROM_THE_COMPILER \
+)
+
+#elif defined( BOOST_NO_DECLTYPE )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "BOOST_AUTO_FUNCTION requires decltype support from the compiler" \
+, BOOST_AUTO_FUNCTION_REQUIRES_DECLTYPE_SUPPORT_FROM_THE_COMPILER \
+)
+
+#else // Otherwise, we don't have a specific message for why it's not supported
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "BOOST_AUTO_FUNCTION is not supported on this compiler" \
+, BOOST_AUTO_FUNCTION_IS_NOT_SUPPORTED_ON_THIS_COMPILER \
+)
+
+#endif // End checks for why BOOST_AUTO_FUNCTION isn't supported
+
+#endif // End check for BOOST_AUTO_FUNCTION support
+
+// If BOOST_BASIC_AUTO_FUNCTION is not supported
+#ifdef BOOST_NO_BOOST_BASIC_AUTO_FUNCTION
+
+// Start a series of checks for why BOOST_BASIC_AUTO_FUNCTION isn't supported
+#ifdef BOOST_NO_VARIADIC_MACROS
+
+#define BOOST_BASIC_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "BOOST_BASIC_AUTO_FUNCTION requires variadic macro support from the compiler"\
+, BOOST_BASIC_AUTO_FUNCTION_REQUIRES_VARIADIC_MACRO_SUPPORT_FROM_THE_COMPILER \
+)
+
+#elif defined( BOOST_NO_TRAILING_RETURN_TYPE )
+
+#define BOOST_BASIC_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "BOOST_BASIC_AUTO_FUNCTION requires trailing return type support from the " \
+ "compiler" \
+, BOOST_BASIC_AUTO_FUNCTION_REQUIRES_TRAILING_RETURN_TYPE_SUPPORT_FROM_THE_ \
+ ## COMPILER \
+)
+
+#elif defined( BOOST_NO_DECLTYPE )
+
+#define BOOST_BASIC_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "BOOST_BASIC_AUTO_FUNCTION requires decltype support from the compiler" \
+, BOOST_BASIC_AUTO_FUNCTION_REQUIRES_DECLTYPE_SUPPORT_FROM_THE_COMPILER \
+)
+
+#else // Otherwise, we don't have a specific message for why it's not supported
+
+#if BOOST_NO_BOOST_AUTO_FUNCTION_PARAM( do )
+
+#define BOOST_BASIC_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "BOOST_BASIC_AUTO_FUNCTION requires \"do\" parameter support with " \
+ "BOOST_AUTO_FUNCTION" \
+, BOOST_BASIC_AUTO_FUNCTION_REQUIRES_DO_PARAMETER_SUPPORT_WITH_BOOST_AUTO_ \
+ ## FUNCTION \
+)
+
+#else // Otherwise, we don't have a specific message for why it's not supported
+
+#define BOOST_BASIC_AUTO_FUNCTION_DETAIL_NO_SUPPORT_ERROR() \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR \
+( "BOOST_BASIC_AUTO_FUNCTION is not supported on this compiler" \
+, BOOST_BASIC_AUTO_FUNCTION_IS_NOT_SUPPORTED_ON_THIS_COMPILER \
+)
+
+#endif // End check for do parameter support
+
+#endif // End checks for why BOOST_BASIC_AUTO_FUNCTION is not supported
+
+#endif // End check for BOOST_BASIC_AUTO_FUNCTION support
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_ERROR_HPP

Added: sandbox/auto_function/boost/auto_function/detail/error_info.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/error_info.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,323 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_HPP
+
+#include <boost/auto_function/detail/error.hpp>
+#include <boost/auto_function/detail/is_parenthesized.hpp>
+#include <boost/auto_function/detail/is_recognized_arg.hpp>
+#include <boost/auto_function/detail/is_valid_name_and_params.hpp>
+#include <boost/auto_function/detail/num_args.hpp>
+#include <boost/auto_function/detail/param.hpp>
+#include <boost/auto_function/detail/param_id.hpp>
+#include <boost/auto_function/detail/param_id_category_value.hpp>
+#include <boost/auto_function/detail/param_id_implies_parentheses.hpp>
+#include <boost/auto_function/support.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/array/data.hpp>
+#include <boost/preprocessor/array/push_back.hpp>
+#include <boost/preprocessor/array/size.hpp>
+#include <boost/preprocessor/control/if.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/logical/bitand.hpp>
+#include <boost/preprocessor/logical/bitor.hpp>
+#include <boost/preprocessor/logical/bool.hpp>
+#include <boost/preprocessor/logical/compl.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/seq/elem.hpp>
+#include <boost/preprocessor/seq/fold_left.hpp>
+#include <boost/preprocessor/seq/for_each.hpp>
+#include <boost/preprocessor/seq/replace.hpp>
+#include <boost/preprocessor/seq/seq.hpp>
+#include <boost/preprocessor/tuple/elem.hpp>
+#include <boost/preprocessor/tuple/to_seq.hpp>
+
+// Takes in the parameters passed to BOOST_AUTO_FUNCTION as a sequence. The
+// sequence should not include the initial argument of function name and params.
+// It yields a sequence of 3 element tuples of an argument number of the error
+// message as a string, and an identifier-format error message
+// ToDo: Handle no errors
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_IMPL \
+( BOOST_PP_TUPLE_TO_SEQ( BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS( __VA_ARGS__ ) \
+ , ( __VA_ARGS__ ) \
+ ) \
+)
+
+// Converts a preprocessor array to a sequence
+#define BOOST_AUTO_FUNCTION_DETAIL_ARRAY_TO_SEQ( result_as_array ) \
+BOOST_PP_TUPLE_TO_SEQ \
+( BOOST_PP_ARRAY_SIZE( result_as_array ) \
+, BOOST_PP_ARRAY_DATA( result_as_array ) \
+)
+
+// Check the first argument (the function name and parameters) for errors
+#define BOOST_AUTO_FUNCTION_DETAIL_CHECK_FIRST_ARG( first_arg ) \
+BOOST_AUTO_FUNCTION_DETAIL_CHECK_FIRST_ARG_IMPL \
+( BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_INFO( first_arg ) )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_CATEGORY_BIT_TABLE_EMPTY() \
+BOOST_PP_REPEAT \
+( BOOST_AUTO_FUNCTION_DETAIL_NUM_PARAM_CATEGORIES \
+, BOOST_AUTO_FUNCTION_DETAIL_PARAM_CATEGORY_BIT_TABLE_EMPTY_MACRO \
+, ~ \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_CATEGORY_BIT_TABLE_EMPTY_MACRO(z,n,t) \
+((0))
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CHECK_FIRST_ARG_IMPL( first_arg_errors ) \
+( BOOST_PP_SEQ_ELEM( 0, first_arg_errors ) )( 2 ) \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_CATEGORY_BIT_TABLE_EMPTY() ) \
+( BOOST_PP_SEQ_ELEM( 1, first_arg_errors ) )
+
+// Same as above only it yields an array instead of a sequence
+// State is a sequence of:
+// A bit specifying if a fatal error was encountered
+// (in which case we don't try to parse any more arguments)
+//
+// A value specifying the current argument number
+// (starts at 2 since error handling for the first arg is handled elsewhere)
+//
+// A sequence of sequences of category info where the first element is a
+// bit that specifies whether or not the category was encountered. If and
+// only if the first element is 1, there is a second element which
+// specifies the line number where the first occurrence of the category
+// appeared
+//
+// An array of errors
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_IMPL( args_as_seq ) \
+BOOST_PP_SEQ_ELEM \
+( 3, BOOST_AUTO_FUNCTION_DETAIL_CHECK_FOR_VALID_END \
+ ( BOOST_PP_SEQ_FOLD_LEFT \
+ ( BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_MACRO \
+ , BOOST_AUTO_FUNCTION_DETAIL_CHECK_FIRST_ARG \
+ ( BOOST_PP_SEQ_HEAD( args_as_seq ) ) \
+ , BOOST_PP_SEQ_TAIL( args_as_seq ) \
+ ) \
+ ) \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CHECK_FOR_VALID_END( error_info ) \
+BOOST_PP_IIF( BOOST_PP_SEQ_ELEM( 0, error_info ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_FORWARD_FATAL_ERROR \
+ , BOOST_AUTO_FUNCTION_DETAIL_CHECK_FOR_VALID_END_IMPL \
+ )( error_info, ~ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CHECK_FOR_VALID_END_IMPL( error_info,dummy )\
+( BOOST_PP_SEQ_ELEM( 0, error_info ) ) \
+( BOOST_PP_INC( BOOST_PP_SEQ_ELEM( 1, error_info ) ) ) \
+( BOOST_PP_SEQ_ELEM( 2, error_info ) ) \
+( BOOST_PP_IIF \
+ ( BOOST_PP_BITOR \
+ ( BOOST_PP_SEQ_HEAD \
+ ( BOOST_PP_SEQ_ELEM \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE( ( do ) ) \
+ , BOOST_PP_SEQ_ELEM( 2, error_info ) \
+ ) \
+ ) \
+ , BOOST_PP_SEQ_HEAD \
+ ( BOOST_PP_SEQ_ELEM \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE( ( explicit ) ) \
+ , BOOST_PP_SEQ_ELEM( 2, error_info ) \
+ ) \
+ ) \
+ ) \
+ , BOOST_PP_SEQ_ELEM( 3, error_info ) \
+ , BOOST_PP_ARRAY_PUSH_BACK \
+ ( BOOST_PP_SEQ_ELEM( 3, error_info ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_ERROR_END_WITHOUT_RESULT_TYPE() \
+ ) \
+ ) \
+)
+
+// Invoked when no error is found (updates line counter and categories)
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_ERROR_WITH_ARGUMENT( data, elem ) \
+( BOOST_PP_SEQ_ELEM( 0, data ) ) \
+( BOOST_PP_INC( BOOST_PP_SEQ_ELEM( 1, data ) ) ) \
+( BOOST_PP_SEQ_REPLACE \
+ ( BOOST_PP_SEQ_ELEM( 2, data ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE( elem ) \
+ , ( 1 )( BOOST_PP_SEQ_ELEM( 1, data ) ) \
+ ) \
+) \
+( BOOST_PP_SEQ_ELEM( 3, data ) )
+
+// Update the "fold" state when we hit an argument that should take a sequence
+// but it is detected that the argument does not have parentheses
+#define BOOST_AUTO_FUNCTION_DETAIL_ARG_ARG_NOT_PAREN_INFO( data, elem ) \
+( BOOST_PP_SEQ_ELEM( 0, data ) ) \
+( BOOST_PP_INC( BOOST_PP_SEQ_ELEM( 1, data ) ) ) \
+( BOOST_PP_SEQ_ELEM( 2, data ) ) \
+( BOOST_PP_ARRAY_PUSH_BACK \
+ ( BOOST_PP_SEQ_ELEM( 3, data ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_ERROR_ARG_ARG_NOT_PAREN \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID( elem ) ) \
+ ) \
+)
+
+// Update the "fold" state when we hit an argument that duplicates a
+// category that was already encountered
+#define BOOST_AUTO_FUNCTION_DETAIL_DUPLICATE_CATEGORY_INFO( data, elem ) \
+( BOOST_PP_SEQ_ELEM( 0, data ) ) \
+( BOOST_PP_INC( BOOST_PP_SEQ_ELEM( 1, data ) ) ) \
+( BOOST_PP_SEQ_ELEM( 2, data ) ) \
+( BOOST_PP_ARRAY_PUSH_BACK \
+ ( BOOST_PP_SEQ_ELEM( 3, data ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_ERROR_MULTIPLE_OF_CATEGORY \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY( elem ) \
+ , BOOST_PP_SEQ_ELEM( 1, data ) \
+ , BOOST_PP_SEQ_ELEM \
+ ( 1 \
+ , BOOST_PP_SEQ_ELEM \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE( elem ) \
+ , BOOST_PP_SEQ_ELEM( 2, data ) \
+ ) \
+ ) \
+ ) \
+ ) \
+)
+
+// Update the "fold" state when we hit an argument that wasn't parenthesized
+// An argument that isn't parenthesized is a fatal error and we can't parse
+// anything after that since we can't know whether or not commas there are
+// intended to end that argument or if they are supposed to be a part of that
+// argument
+#define BOOST_AUTO_FUNCTION_DETAIL_NOT_PARENTHESIZED( data, elem ) \
+( 1 ) \
+( ~ ) \
+( ~ ) \
+( BOOST_PP_ARRAY_PUSH_BACK \
+ ( BOOST_PP_SEQ_ELEM( 3, data ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_ERROR_NOT_PARENTHESIZED \
+ ( BOOST_PP_SEQ_ELEM( 1, data ), elem ) \
+ ) \
+)
+
+// Update the "fold" state when we hit an unrecognized param id
+#define BOOST_AUTO_FUNCTION_DETAIL_UNRECOGNIZED_ARG( data, elem ) \
+( BOOST_PP_SEQ_ELEM( 0, data ) ) \
+( BOOST_PP_INC( BOOST_PP_SEQ_ELEM( 1, data ) ) ) \
+( BOOST_PP_SEQ_ELEM( 2, data ) ) \
+( BOOST_PP_ARRAY_PUSH_BACK \
+ ( BOOST_PP_SEQ_ELEM( 3, data ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_ERROR_UNRECOGNIZED_PARAM_ID \
+ ( BOOST_PP_SEQ_ELEM( 1, data ), elem ) \
+ ) \
+)
+
+// On a fatal error don't bother trying to parse any more arguments
+#define BOOST_AUTO_FUNCTION_DETAIL_FORWARD_FATAL_ERROR( data, elem ) data
+
+// Determines if the category of this argument has already appeared
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_DUPLICATE_CATEGORY( data, elem ) \
+BOOST_PP_SEQ_ELEM \
+( 0 \
+, BOOST_PP_SEQ_ELEM( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE( elem )\
+ , BOOST_PP_SEQ_ELEM( 2, data ) \
+ ) \
+)
+
+// Update the "fold" state when we hit a parameter kind that we can't support
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_NO_SUPPORT_INFO( data, elem ) \
+( BOOST_PP_SEQ_ELEM( 0, data ) ) \
+( BOOST_PP_INC( BOOST_PP_SEQ_ELEM( 1, data ) ) ) \
+( BOOST_PP_SEQ_ELEM( 2, data ) ) \
+( BOOST_PP_ARRAY_PUSH_BACK \
+ ( BOOST_PP_SEQ_ELEM( 3, data ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_ERROR_NO_PARAM_SUPPORT \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID( elem ) \
+ , BOOST_PP_SEQ_ELEM( 1, data ) \
+ ) \
+ ) \
+)
+
+// Checks starting after we have recognized the parameter kind
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_MACRO_RECOGNIZED( data, elem ) \
+BOOST_PP_IIF \
+( BOOST_NO_BOOST_AUTO_FUNCTION_PARAM \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID( elem ) ) \
+, BOOST_AUTO_FUNCTION_DETAIL_ERROR_NO_SUPPORT_INFO \
+, BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_MACRO_SUPPORTED \
+)( data, elem )
+
+// Checks starting after we have determined that the parameter kind is supported
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_MACRO_SUPPORTED( data, elem ) \
+BOOST_PP_IIF \
+( BOOST_AUTO_FUNCTION_DETAIL_IS_DUPLICATE_CATEGORY( data, elem ) \
+, BOOST_AUTO_FUNCTION_DETAIL_DUPLICATE_CATEGORY_INFO \
+, BOOST_AUTO_FUNCTION_DETAIL_ERROR_NO_DUPLICATE \
+)( data, elem )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_LACKS_PARENT_FOR_ARG( data, elem ) \
+BOOST_PP_BITAND \
+( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PARENTHESES( elem ) \
+, BOOST_PP_COMPL \
+ ( BOOST_AUTO_FUNCTION_DETAIL_STARTS_PARENTHESIZED \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM( elem ) ) \
+ ) \
+)
+
+// Checks starting after we have determined that there is not a duplicate
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_NO_DUPLICATE( data, elem ) \
+BOOST_PP_IIF \
+( BOOST_AUTO_FUNCTION_DETAIL_LACKS_PARENT_FOR_ARG( data, elem ) \
+, BOOST_AUTO_FUNCTION_DETAIL_ARG_ARG_NOT_PAREN_INFO \
+, BOOST_AUTO_FUNCTION_DETAIL_NO_ERROR_WITH_ARGUMENT \
+)( data, elem )
+
+// Checks starting after it is established that the argument is parenthesized
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_MACRO_PARENTHESIZED( data, elem )\
+BOOST_PP_IIF \
+( BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_ARG( elem ) \
+, BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_MACRO_RECOGNIZED \
+, BOOST_AUTO_FUNCTION_DETAIL_UNRECOGNIZED_ARG \
+)( data, elem )
+
+// data is a 2 element tuple of the current argument number and an array of
+// tuples of argument numbers and the associated unrecognized argument
+// ToDo: Push off some of the checks to other macros to prevent errors when not
+// parenthesized properly or when there are too many commas
+#define BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_MACRO( s, data, elem ) \
+BOOST_PP_IIF \
+( BOOST_PP_SEQ_ELEM( 0, data ) \
+, BOOST_AUTO_FUNCTION_DETAIL_FORWARD_FATAL_ERROR \
+, BOOST_PP_IIF \
+ ( BOOST_AUTO_FUNCTION_DETAIL_STARTS_PARENTHESIZED( elem ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_MACRO_PARENTHESIZED \
+ , BOOST_AUTO_FUNCTION_DETAIL_NOT_PARENTHESIZED \
+ ) \
+)( data, elem )
+
+// Yields 1 if there were errors, otherwise it yields 0
+#define BOOST_AUTO_FUNCTION_DETAIL_HAS_ERRORS( error_array ) \
+BOOST_PP_BOOL( BOOST_PP_ARRAY_SIZE( error_array ) )
+
+// Yields all errors as statements
+#define BOOST_AUTO_FUNCTION_DETAIL_EMIT_ERRORS( error_array ) \
+BOOST_PP_IF( BOOST_PP_ARRAY_SIZE( error_array ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_EMIT_ERRORS_IMPL \
+ , BOOST_AUTO_FUNCTION_DETAIL_EMIT_NO_ERRORS_IMPL \
+ )( error_array )
+
+// Do nothing if there are no errors to emit
+#define BOOST_AUTO_FUNCTION_DETAIL_EMIT_NO_ERRORS_IMPL( error_array )
+
+// Yields all errors as statements (only valid if array size is greater than 1)
+#define BOOST_AUTO_FUNCTION_DETAIL_EMIT_ERRORS_IMPL( error_array ) \
+void BOOST_PP_CAT( failed_auto_function_on_line_, __LINE__ )(); \
+BOOST_PP_SEQ_FOR_EACH \
+( BOOST_AUTO_FUNCTION_DETAIL_EMIT_ERROR_IMPL, ~ \
+, BOOST_AUTO_FUNCTION_DETAIL_ARRAY_TO_SEQ( error_array ) \
+)
+
+// Yields an error as a statement
+#define BOOST_AUTO_FUNCTION_DETAIL_EMIT_ERROR_IMPL( r, dummy, error ) error;
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_ERROR_INFO_HPP

Added: sandbox/auto_function/boost/auto_function/detail/head_argument.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/head_argument.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,20 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT_HPP
+
+#define BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT_IMPL( __VA_ARGS__, _0 )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT_IMPL( head, ... ) head
+
+#define BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT_AFTER_RESCAN( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT( __VA_ARGS__ )
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT_HPP

Added: sandbox/auto_function/boost/auto_function/detail/is_conditional_arg.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/is_conditional_arg.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,30 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG_HPP
+
+#include <boost/auto_function/detail/param_id_category.hpp>
+#include <boost/preprocessor/cat.hpp>
+
+// A macro that assigns a unique value to each different parameter kind
+// This macro takes the entire argument including the name
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG( arg_in_paren ) \
+BOOST_PP_CAT \
+( BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG_ \
+, BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY( arg_in_paren ) \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG_auto_if 1
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG_auto_try 1
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG_do 0
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG_explicit 0
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG_if 1
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG_try 1
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_IS_CONDITIONAL_ARG_HPP

Added: sandbox/auto_function/boost/auto_function/detail/is_parenthesized.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/is_parenthesized.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,25 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_STARTS_PARENTHESIZED_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_STARTS_PARENTHESIZED_HPP
+
+#include <boost/auto_function/detail/128_args.hpp>
+#include <boost/auto_function/detail/num_args.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+
+#define BOOST_AUTO_FUNCTION_DETAIL_STARTS_PARENTHESIZED( arg ) \
+BOOST_PP_EQUAL \
+( BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS \
+ ( BOOST_AUTO_FUNCTION_DETAIL_STARTS_PARENTHESIZED_IMPL arg ) \
+, 2 \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_STARTS_PARENTHESIZED_IMPL( ... ) _1,_2
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_STARTS_PARENTHESIZED_HPP

Added: sandbox/auto_function/boost/auto_function/detail/is_recognized_arg.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/is_recognized_arg.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,85 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_ARG_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_ARG_HPP
+
+#include <boost/auto_function/detail/128_args.hpp>
+#include <boost/auto_function/detail/num_args.hpp>
+#include <boost/auto_function/detail/param_id.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/comparison/greater.hpp>
+
+// This macro "works" in a very hackish way. It concatenates a base macro name
+// with the argument. If it's a recognized name, this will produce an invocation
+// that yields text with at least 127 top-level commas (top-level meaning not
+// surrounded by parentheses). How many top-level args are then checked and if
+// the number is greater than 127, we assume that the param id was correctly
+// identified. Note that this can fail if the produced comma-separated list has
+// more commas than can be handled by the macro which checks how many arguments
+// are passed. In practice this will likely never come up, but if it does, the
+// number of arguments supported by the size-checking macro can be easily
+// increased. One possible place this may cause a problem is if someone has an
+// initializer list in a "do" with over 128 elements.
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_ARG( arg_in_paren ) \
+BOOST_PP_GREATER \
+( BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS \
+ ( BOOST_PP_CAT \
+ ( BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_ \
+ , BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID( arg_in_paren ) \
+ ) \
+ ) \
+, 127 \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_auto_explicit \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_auto_if \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_auto_not \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_auto_try \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_do \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_explicit \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_if \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_not \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_return \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_return_ref \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_return_rvalue_ref \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_return_value \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_try \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_virtual_explicit \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_void \
+BOOST_AUTO_FUNCTION_DETAIL_128_ARGS()
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_ARG_HPP

Added: sandbox/auto_function/boost/auto_function/detail/is_valid_name_and_params.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/is_valid_name_and_params.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,80 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_HPP
+
+#include <boost/auto_function/detail/error.hpp>
+#include <boost/auto_function/detail/is_parenthesized.hpp>
+#include <boost/auto_function/detail/num_args.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/logical/bitand.hpp>
+
+// If this is the case, we can't do any more checking at this point, so don't
+// yield an error
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_NOT_COMMA( arg ) 1
+
+// If we have more than one comma then this can't possibly be a valid function
+// header (since conversion operators can't be supported by BOOST_AUTO_FUNCTION)
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_TOO_MANY_ARGS(...) 0
+
+// Check if the first parameter is "operator"
+// ToDo: If you are experiencing problems when operator is passed, this may need
+// to be changed to force an expansion before passing the args to "NUM_ARGS"
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_OPERATOR( name ) \
+BOOST_PP_EQUAL \
+( BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS \
+ ( BOOST_AUTO_FUNCTION_DETAIL_IS_OPERATOR_ ## name ) \
+, 2 \
+)
+
+// Yields 2 tokens separate by a comma
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_OPERATOR_operator _0, _1
+
+// If it's 2 arguments, we need to check that the first argument is "operator"
+// and the that second parameter starts with something that's parenthesized
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_COMMA(name,params) \
+BOOST_PP_BITAND \
+( BOOST_AUTO_FUNCTION_DETAIL_IS_OPERATOR( name ) \
+, BOOST_AUTO_FUNCTION_DETAIL_STARTS_PARENTHESIZED( params ) \
+)
+
+// Note: argument must have the first set of parenthesis stripped
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS(name_params_paren) \
+BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_IMPL name_params_paren
+
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_IMPL( ... ) \
+BOOST_PP_IIF \
+( BOOST_PP_EQUAL( BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS( __VA_ARGS__ ), 1 ) \
+, BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_NOT_COMMA \
+, BOOST_PP_IIF \
+ ( BOOST_PP_EQUAL( BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS( __VA_ARGS__ ), 2 ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_COMMA \
+ , BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_TOO_MANY_ARGS \
+ ) \
+)( __VA_ARGS__ )
+
+// Yields a 2 element sequence of a bit specified as 1 if there's a fatal error
+// with the second element of the sequence being an array of errors.
+#define BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_INFO( arg ) \
+BOOST_PP_IIF \
+( BOOST_AUTO_FUNCTION_DETAIL_STARTS_PARENTHESIZED( arg ) \
+, BOOST_PP_IIF \
+ ( BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS( arg ) \
+ , (0)((0,())) \
+ , (0)((1,( BOOST_AUTO_FUNCTION_DETAIL_ERROR_INVALID_NAME_AND_PARAMS() ))) \
+ ) \
+, (1) \
+ (( 1 \
+ ,( BOOST_AUTO_FUNCTION_DETAIL_ERROR_NOT_PARENTHESIZED( 1, arg ) ) \
+ ) \
+ ) \
+)
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_IS_VALID_NAME_AND_PARAMS_HPP

Added: sandbox/auto_function/boost/auto_function/detail/num_args.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/num_args.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,65 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS_HPP
+
+// Implementation based on macros by Laurent Deniau
+
+// Yields the number of arguments passed to a variadic macro
+#define BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS_IMPL \
+( __VA_ARGS__ \
+, BOOST_AUTO_FUNCTION_DETAIL_DECENDING_VALUES() \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NUM_WRAPPED_ARGS( args ) \
+BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS args
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS_AFTER_RESCAN( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS( __VA_ARGS__ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS_IMPL( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS_IMPL_N( __VA_ARGS__ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS_IMPL_N( \
+ _00,_01,_02,_03,_04,_05,_06,_07,_08,_09,_0a,_0b,_0c,_0d,_0e,_0f \
+,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a,_1b,_1c,_1d,_1e,_1f \
+,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_2a,_2b,_2c,_2d,_2e,_2f \
+,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_3a,_3b,_3c,_3d,_3e,_3f \
+,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_4a,_4b,_4c,_4d,_4e,_4f \
+,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_5a,_5b,_5c,_5d,_5e,_5f \
+,_60,_61,_62,_63,_64,_65,_66,_67,_68,_69,_6a,_6b,_6c,_6d,_6e,_6f \
+,_70,_71,_72,_73,_74,_75,_76,_77,_78,_79,_7a,_7b,_7c,_7d,_7e,_7f \
+,_80,_81,_82,_83,_84,_85,_86,_87,_88,_89,_8a,_8b,_8c,_8d,_8e,_8f \
+,_90,_91,_92,_93,_94,_95,_96,_97,_98,_99,_9a,_9b,_9c,_9d,_9e,_9f \
+,_a0,_a1,_a2,_a3,_a4,_a5,_a6,_a7,_a8,_a9,_aa,_ab,_ac,_ad,_ae,_af \
+,_b0,_b1,_b2,_b3,_b4,_b5,_b6,_b7,_b8,_b9,_ba,_bb,_bc,_bd,_be,_bf \
+,_c0,_c1,_c2,_c3,_c4,_c5,_c6,_c7,_c8,_c9,_ca,_cb,_cc,_cd,_ce,_cf \
+,_d0,_d1,_d2,_d3,_d4,_d5,_d6,_d7,_d8,_d9,_da,_db,_dc,_dd,_de,_df \
+,_e0,_e1,_e2,_e3,_e4,_e5,_e6,_e7,_e8,_e9,_ea,_eb,_ec,_ed,_ee,_ef \
+,_f0,_f1,_f2,_f3,_f4,_f5,_f6,_f7,_f8,_f9,_fa,_fb,_fc,_fd,_fe,_ff \
+,N,...) N
+
+#define BOOST_AUTO_FUNCTION_DETAIL_DECENDING_VALUES() \
+ 256,255,254,253,252,251,250,249,248,247,246,245,244,243,242,241,240,239,238 \
+,237,236,235,234,233,232,231,230,229,228,227,226,225,224,223,222,221,220,219 \
+,218,217,216,215,214,213,212,211,210,209,208,207,206,205,204,203,202,201,200 \
+,199,198,197,196,195,194,193,192,191,190,189,188,187,186,185,184,183,182,181 \
+,180,179,178,177,176,175,174,173,172,171,170,169,168,167,166,165,164,163,162 \
+,161,160,159,158,157,156,155,154,153,152,151,150,149,148,147,146,145,144,143 \
+,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,127,126,125,124 \
+,123,122,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105 \
+,104,103,102,101,100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86 \
+, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67 \
+, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48 \
+, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29 \
+, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10 \
+, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_NUM_ARGS_HPP

Added: sandbox/auto_function/boost/auto_function/detail/param.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/param.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,24 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_PARAM_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_HPP
+
+#include <boost/auto_function/detail/rescan.hpp>
+#include <boost/auto_function/detail/split_param_id_and_param.hpp>
+#include <boost/auto_function/detail/tail_arguments.hpp>
+
+// A macro that assigns a unique value to each different parameter kind
+// This macro takes the entire argument including the name
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM( arg_in_paren ) \
+BOOST_AUTO_FUNCTION_DETAIL_RESCAN \
+( BOOST_AUTO_FUNCTION_DETAIL_TAIL_ARGUMENTS_AFTER_RESCAN \
+ ( BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM( arg_in_paren ) )() \
+)
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_PARAM_HPP

Added: sandbox/auto_function/boost/auto_function/detail/param_id.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/param_id.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,59 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HPP
+
+#include <boost/auto_function/detail/head_argument.hpp>
+#include <boost/auto_function/detail/split_param_id_and_param.hpp>
+
+// A macro that assigns a single-token name to each parambased on its param id
+// (it removes spaces from multiword param ids and replaces them with _)
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID( arg_in_paren ) \
+BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT_AFTER_RESCAN \
+( BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM( arg_in_paren ) )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID( param_id ) \
+BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_ ## param_id
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_auto_explicit auto explicit
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_auto_if auto if
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_auto_not auto not
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_auto_try auto try
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_do do
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_explicit explicit
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_if if
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_not not
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_return return
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_return_ref return_ref
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_return_rvalue_ref return_rvalue_ref
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_return_value return_value
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_try try
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_virtual_explicit virtual explicit
+#define BOOST_AUTO_FUNCTION_DETAIL_SPACED_ID_void void
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID( param_id ) \
+BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_ ## param_id
+
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_auto_explicit AUTO_EXPLICIT
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_auto_if AUTO_IF
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_auto_not AUTO_NOT
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_auto_try AUTO_TRY
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_do DO
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_explicit EXPLICIT
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_if IF
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_not NOT
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_return RETURN
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_return_ref RETURN_REF
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_return_rvalue_ref RETURN_RVALUE_REF
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_return_value RETURN_VALUE
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_try TRY
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_virtual_explicit VIRTUAL_EXPLICIT
+#define BOOST_AUTO_FUNCTION_DETAIL_CAPS_ID_void VOID
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HPP

Added: sandbox/auto_function/boost/auto_function/detail/param_id_category.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/param_id_category.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,45 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_HPP
+
+#include <boost/auto_function/detail/param_id.hpp>
+#include <boost/preprocessor/cat.hpp>
+
+// Whenever a category is added, the value macros must also be updated in
+// <boost/auto_function/detail/param_id_category_value.hpp>
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY( arg_in_paren ) \
+BOOST_PP_CAT( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_ \
+ , BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID( arg_in_paren ) \
+ )
+
+// Macros that associate param IDs with the category that they belong to
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_auto_if auto_if
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_auto_not auto_if
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_auto_try auto_try
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_auto_explicit explicit
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_explicit explicit
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_virtual_explicit explicit
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_do do
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_return do
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_return_ref do
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_return_rvalue_ref do
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_return_value do
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_void do
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_if if
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_not if
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_try try
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_HPP

Added: sandbox/auto_function/boost/auto_function/detail/param_id_category_value.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/param_id_category_value.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,36 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE_HPP
+
+#include <boost/auto_function/detail/param_id_category.hpp>
+#include <boost/preprocessor/cat.hpp>
+
+// Whenever a category value is added, the category macros must also be updated
+// in <boost/auto_function/detail/param_id_category.hpp>
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE( arg_in_paren ) \
+BOOST_PP_CAT( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE_ \
+ , BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY( arg_in_paren ) \
+ )
+
+// Macros that associate each param category ID with a unique value
+// Note: If a category is added, it is important to update
+// BOOST_AUTO_FUNCTION_DETAIL_NUM_PARAM_CATEGORIES as well
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE_auto_if 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE_auto_try 1
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE_do 2
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE_explicit 3
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE_if 4
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE_try 5
+
+// Update this whenever a new category is added
+#define BOOST_AUTO_FUNCTION_DETAIL_NUM_PARAM_CATEGORIES 6
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_CATEGORY_VALUE_HPP

Added: sandbox/auto_function/boost/auto_function/detail/param_id_implies_parentheses.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/param_id_implies_parentheses.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,39 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PARENTHESES_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PARENTHESES_HPP
+
+#include <boost/auto_function/detail/param_id.hpp>
+#include <boost/preprocessor/cat.hpp>
+
+// A macro that assigns a unique value to each different parameter kind
+// This macro takes the entire argument including the name
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PARENTHESES( arg_in_paren )\
+BOOST_PP_CAT \
+( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_ \
+, BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID( arg_in_paren ) \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_auto_explicit 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_auto_if 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_auto_not 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_auto_try 1
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_do 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_explicit 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_if 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_not 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_return 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_return_ref 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_return_rvalue_ref 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_return_value 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_try 1
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_virtual_explicit 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PAREN_void 0
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_IMPLIES_PARENTHESES_HPP

Added: sandbox/auto_function/boost/auto_function/detail/param_id_value.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/param_id_value.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,39 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_HPP
+
+#include <boost/auto_function/detail/param_id.hpp>
+#include <boost/preprocessor/cat.hpp>
+
+// A macro that assigns a unique value to each different parameter kind
+// This macro takes the entire argument including the name
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE( arg_in_paren ) \
+BOOST_PP_CAT \
+( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_ \
+, BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID( arg_in_paren ) \
+)
+
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_auto_explicit 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_auto_if 1
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_auto_not 2
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_auto_try 3
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_do 4
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_explicit 5
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_if 6
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_not 7
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_return 8
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_return_ref 9
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_return_rvalue_ref 10
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_return_value 11
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_try 12
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_virtual_explicit 13
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_void 14
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_VALUE_HPP

Added: sandbox/auto_function/boost/auto_function/detail/param_templates.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/param_templates.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,264 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_PARAM_TEMPLATES_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_TEMPLATES_HPP
+
+#include <boost/auto_function/support.hpp>
+
+#ifndef BOOST_NO_BOOST_AUTO_FUNCTION
+
+#include <boost/auto_function/limits.hpp>
+#include <boost/config.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/empty_base.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/is_void.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+
+#if 0
+
+#if !( BOOST_NO_BOOST_AUTO_FUNCTION_PARAM( auto if ) \
+ && BOOST_NO_BOOST_AUTO_FUNCTION_PARAM( auto not ) \
+ )
+#include <boost/mpl/apply.hpp>
+#endif
+
+#else
+
+#include <boost/mpl/apply.hpp>
+
+#endif
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+#include <boost/type_traits/add_rvalue_reference.hpp>
+#else
+#include <boost/type_traits/add_reference.hpp>
+#endif
+
+// Headers needed if we have to simulate variadic templates
+#ifdef BOOST_NO_VARIADIC_TEMPLATES
+
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/facilities/intercept.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+
+#endif // End check for variadic templates
+
+// ToDo: Use is_convertible to bool checks in the SFINAE conditions for the
+// metafunction versions of the if, not, auto if, and auto not arguments
+
+// ToDo: Implement auto family of argument types
+
+namespace boost { namespace auto_function { namespace detail {
+
+// Used for triggering SFINAE
+template< class DummyType, class OtherDummyType = void >
+struct always_void { typedef void type; };
+
+// Used for triggering SFINAE
+template< bool DummyBoolValue >
+struct always_void_by_bool { typedef void type; };
+
+// Used for triggering SFINAE
+template< class AlwaysType, class DummyType = void >
+struct always { typedef AlwaysType type; };
+
+//Used to specify a condition that is required for an auto function
+template< bool Value >
+struct if_ {};
+
+template<>
+struct if_< true > { typedef void type; };
+
+////////////////////////////////////////////////////////////////////////////////
+// Here's where some magic happens... the BOOST_AUTO_FUNCTION macro allows //
+// "if" to take either a value or a type, and automatically handles both //
+// without the user having to tell the macro which one it is passing. The //
+// trick I use internally relies on the fact that bool( arg ) is a function //
+// type when "arg" is a type, and a compile-time constant bool when "arg" is a//
+// compile-time constant convertible to bool. So, if I make two function //
+// template overloads, one which takes a compile-time bool as a template //
+// argument, and another that takes a type, I can make the expression //
+// "decltype( make_if< bool( arg ) >() )" "do the right thing" in both //
+// cases. Further, since "arg" is now parenthesized, expressions that have a >//
+// such as "sizeof( left ) > sizeof( right )" won't incorrectly end the //
+// template argument list. //
+////////////////////////////////////////////////////////////////////////////////
+template< bool Value >
+typename if_< Value >::type
+your_if_condition_isnt_dependent_on_a_function_template_argument();
+
+template< class FunctionType, class Enabler = void >
+struct result_of_if_check;
+
+template< class BoolMetavalue >
+struct result_of_if_check
+ < bool ( BoolMetavalue )
+ , typename always_void_by_bool< BoolMetavalue::value >::type
+ >
+ : if_< BoolMetavalue::value > {};
+
+template< class ValueAsFunctionParam >
+typename result_of_if_check< ValueAsFunctionParam >::type
+your_if_condition_isnt_dependent_on_a_function_template_argument();
+
+//template< bool Value >
+//typename if_< Value >::type perform_auto_if_check();
+
+template< class ReturnType, class FunctionType, class Enabler = void >
+struct result_of_perform_auto_if_check;
+
+template< class ReturnType, class BoolMetafunction >
+struct result_of_perform_auto_if_check
+ < ReturnType, bool ( BoolMetafunction )
+ , typename always_void_by_bool
+ < ::boost::mpl::apply< BoolMetafunction, ReturnType >::type::value >
+ ::type
+ >
+ : if_< ::boost::mpl::apply< BoolMetafunction, ReturnType >::type::value > {};
+
+template< class ReturnType, class ValueAsFunctionParam >
+typename result_of_perform_auto_if_check
+< ReturnType, ValueAsFunctionParam >::type
+perform_auto_if_check();
+
+template< class ReturnType, class FunctionType, class Enabler = void >
+struct result_of_perform_auto_not_check;
+
+template< class ReturnType, class BoolMetafunction >
+struct result_of_perform_auto_not_check
+ < ReturnType, bool ( BoolMetafunction )
+ , typename always_void_by_bool
+ < ::boost::mpl::apply< BoolMetafunction, ReturnType >::type::value >
+ ::type
+ >
+ : if_< !::boost::mpl::apply< BoolMetafunction, ReturnType >::type::value > {};
+
+template< class ReturnType, class ValueAsFunctionParam >
+typename result_of_perform_auto_not_check
+< ReturnType, ValueAsFunctionParam >::type
+perform_auto_not_check();
+
+template< bool Value >
+typename if_< !Value >::type
+your_not_condition_isnt_dependent_on_a_function_template_argument();
+
+template< class FunctionType, class Enabler = void >
+struct result_of_perform_not_check;
+
+template< class BoolMetavalue >
+struct result_of_perform_not_check
+ < bool ( BoolMetavalue )
+ , typename always_void_by_bool< BoolMetavalue::value >::type
+ >
+ : if_< !BoolMetavalue::value > {};
+
+template< class ValueAsFunctionParam >
+typename result_of_perform_not_check< ValueAsFunctionParam >::type
+your_not_condition_isnt_dependent_on_a_function_template_argument();
+
+#ifndef BOOST_NO_VARIADIC_TEMPLATES
+
+// Used with decltype in return types to get SFINAE
+template< class... T >
+struct types;
+
+#else
+
+// Used with decltype in return types to get SFINAE
+template< BOOST_PP_ENUM_BINARY_PARAMS
+ ( BOOST_PP_INC( BOOST_AUTO_FUNCTION_MAX_REQUIRES_EXPRESSIONS )
+ , T, = void BOOST_PP_INTERCEPT
+ )
+ >
+struct types;
+
+#endif // End no variadic template check
+
+template< class T >
+struct perform_try_check;
+
+template< class ReturnType >
+ReturnType impl_explicit_type();
+
+template< class ReturnTypeMetafunction >
+typename ReturnTypeMetafunction::type impl_virtual_explicit_type();
+
+template< class PossibleReferenceType >
+typename remove_reference< PossibleReferenceType >::type
+impl_return_value_type();
+
+template< class DummyType >
+typename always_void< DummyType >::type impl_return_void_type();
+
+template< class ReturnType, class SFINAEType >
+typename always< ReturnType, SFINAEType >::type impl_explicit();
+
+template< class ReturnType, class SFINAEType >
+typename always< ReturnType, SFINAEType >::type impl_do();
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+
+template< typename T >
+struct return_expression_type : add_rvalue_reference< T > {};
+
+#else
+
+// ToDo: Possibly change this
+template< typename T >
+struct return_expression_type : add_reference< T > {};
+
+#endif
+
+template< class RawDoReturnType, class ExplicitType >
+struct is_raw_do_convertible_to_explicit_nonvoid
+ : is_convertible< typename return_expression_type< RawDoReturnType >::type
+ , ExplicitType
+ > {};
+
+template< class RawDoReturnType, class ExplicitType >
+struct is_raw_do_convertible_to_explicit
+ : mpl::if_< is_void< ExplicitType >
+ , mpl::true_
+ , is_raw_do_convertible_to_explicit_nonvoid< RawDoReturnType
+ , ExplicitType
+ >
+ >::type {};
+
+// A metafunction to determine if a 1-line return is compatible with an
+// explicitly-specified explicit_
+template< class ExplicitType, class RawDoReturnType >
+struct is_valid_explicit_for_raw_do
+ : mpl::and_
+ < mpl::equal_to< is_void< ExplicitType >, is_void< RawDoReturnType > >
+ , is_raw_do_convertible_to_explicit< RawDoReturnType, ExplicitType >
+ > {};
+
+template< class ExplicitType, class RawDoReturnType, class SFINAEType >
+struct impl_explicit_and_do_return_type
+ : mpl::if_
+ < is_valid_explicit_for_raw_do< ExplicitType, RawDoReturnType >
+ , mpl::identity< ExplicitType >
+ , mpl::empty_base
+ >::type {};
+
+template< class ExplicitType, class RawDoReturnType, class SFINAEType >
+typename impl_explicit_and_do_return_type
+< ExplicitType, RawDoReturnType, SFINAEType >::type
+impl_explicit_and_do();
+
+} } }
+
+#endif // End check for BOOST_AUTO_FUNCTION support
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_PARAM_TEMPLATES_HPP

Added: sandbox/auto_function/boost/auto_function/detail/rescan.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/rescan.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_RESCAN_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_RESCAN_HPP
+
+#define BOOST_AUTO_FUNCTION_DETAIL_RESCAN( ... ) __VA_ARGS__
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_RESCAN_HPP

Added: sandbox/auto_function/boost/auto_function/detail/split_param_id_and_param.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/split_param_id_and_param.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,144 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_HPP
+
+#include <boost/auto_function/detail/head_argument.hpp>
+#include <boost/auto_function/detail/variadic_cat.hpp>
+#include <boost/config.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/facilities/empty.hpp>
+
+#define BOOST_AUTO_FUNCTION_DETAIL_EAT_AUTO_auto
+
+#define BOOST_AUTO_FUNCTION_DETAIL_EAT_VIRTUAL_virtual
+
+// Macros that combine "auto" with its secondary param ID and separates
+// the param ID from the parameter by a comma
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_AUTO_PARAM_ID_AND_PARAM_explicit \
+auto_explicit,
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_AUTO_PARAM_ID_AND_PARAM_if \
+auto_if,
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_AUTO_PARAM_ID_AND_PARAM_not \
+auto_not,
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_AUTO_PARAM_ID_AND_PARAM_try \
+auto_try,
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_VIRTUAL_PARAM_ID_AND_PARAM_explicit \
+virtual_explicit,
+
+// Macros that separate 1 word param IDs from the parameter by a comma
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_do do,
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_explicit explicit,
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_if if,
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_not not,
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_return return,
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_return_ref \
+return_ref,
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_return_rvalue_ref \
+return_rvalue_ref,
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_return_value \
+return_value,
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_void \
+void,
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_try try,
+
+// Macros that determine if auto is the first word of a param ID
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_auto 1,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_do 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_explicit 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_if 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_not 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_return 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_return_ref 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_return_rvalue_ref 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_return_value 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_try 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_virtual 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_void 0,
+
+// Macros that determine if virtual is the first word of a param ID
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_auto 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_do 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_explicit 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_if 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_not 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_return 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_return_ref 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_return_rvalue_ref 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_return_value 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_try 0,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_virtual 1,
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_void 0,
+
+// Combines "auto" with the secondary param ID and separates the full ID
+// from the parameter by a comma
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_AUTO_IMPL(...) \
+BOOST_AUTO_FUNCTION_DETAIL_VARIADIC_CAT \
+( BOOST_AUTO_FUNCTION_DETAIL_SPLIT_AUTO_PARAM_ID_AND_PARAM_ \
+, BOOST_AUTO_FUNCTION_DETAIL_EAT_AUTO_ ## __VA_ARGS__ \
+)
+
+// Combines "virtual" with the secondary param ID and separates the full ID
+// from the parameter by a comma
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_VIRTUAL_IMPL(...) \
+BOOST_AUTO_FUNCTION_DETAIL_VARIADIC_CAT \
+( BOOST_AUTO_FUNCTION_DETAIL_SPLIT_VIRTUAL_PARAM_ID_AND_PARAM_ \
+, BOOST_AUTO_FUNCTION_DETAIL_EAT_VIRTUAL_ ## __VA_ARGS__ \
+)
+
+// Yields 1 if the parameter id starts with "auto"
+// otherwise yields 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT_AFTER_RESCAN \
+( BOOST_AUTO_FUNCTION_DETAIL_VARIADIC_CAT \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO_ \
+ , __VA_ARGS__ \
+ ) \
+)
+
+// Yields 1 if the parameter id starts with "virtual"
+// otherwise yields 0
+#define BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_HEAD_ARGUMENT_AFTER_RESCAN \
+( BOOST_AUTO_FUNCTION_DETAIL_VARIADIC_CAT \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL_ \
+ , __VA_ARGS__ \
+ ) \
+)
+
+// Separates a param id from the parameter by a comma
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_IMPL( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_ ## __VA_ARGS__
+
+// Separates a param id from the parameter by a comma
+// If the parameter ID is multiple words, it combines them and replaces spaces
+// with underscores
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM( arg_in_paren ) \
+BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_IML arg_in_paren
+
+#define BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_IML( ... ) \
+BOOST_PP_IIF \
+( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_AUTO( __VA_ARGS__ ) \
+, BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_AUTO_IMPL \
+, BOOST_PP_IIF \
+ ( BOOST_AUTO_FUNCTION_DETAIL_PARAM_ID_HAS_VIRTUAL( __VA_ARGS__ ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_VIRTUAL_IMPL \
+ , BOOST_AUTO_FUNCTION_DETAIL_SPLIT_PARAM_ID_AND_PARAM_IMPL \
+ ) \
+)( __VA_ARGS__ BOOST_PP_EMPTY )
+
+#endif //BOOST_AUTO_FUNCTION_DETAIL_SPLIT_SPLIT_PARAM_ID_AND_PARAM_AND_PARAM_HPP

Added: sandbox/auto_function/boost/auto_function/detail/tail_arguments.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/tail_arguments.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,17 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_TAIL_ARGUMENTS_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_TAIL_ARGUMENTS_HPP
+
+#define BOOST_AUTO_FUNCTION_DETAIL_TAIL_ARGUMENTS( head, ... ) __VA_ARGS__
+
+#define BOOST_AUTO_FUNCTION_DETAIL_TAIL_ARGUMENTS_AFTER_RESCAN( ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_TAIL_ARGUMENTS( __VA_ARGS__ )
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_TAIL_ARGUMENTS_HPP

Added: sandbox/auto_function/boost/auto_function/detail/variadic_cat.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/detail/variadic_cat.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,19 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_DETAIL_VARIADIC_CAT_HPP
+#define BOOST_AUTO_FUNCTION_DETAIL_VARIADIC_CAT_HPP
+
+// Forces rescan
+#define BOOST_AUTO_FUNCTION_DETAIL_VARIADIC_CAT( left_, ... ) \
+BOOST_AUTO_FUNCTION_DETAIL_VARIADIC_CAT_IMPL( left_, __VA_ARGS__ )
+
+#define BOOST_AUTO_FUNCTION_DETAIL_VARIADIC_CAT_IMPL( left_, ... ) \
+left_ ## __VA_ARGS__
+
+#endif // BOOST_AUTO_FUNCTION_DETAIL_VARIADIC_CAT_HPP

Added: sandbox/auto_function/boost/auto_function/limits.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/limits.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,19 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_LIMITS_HPP
+#define BOOST_AUTO_FUNCTION_LIMITS_HPP
+
+#include <boost/config.hpp>
+
+// Only used when variadic templates aren't supported
+#ifndef BOOST_AUTO_FUNCTION_MAX_REQUIRES_EXPRESSIONS
+#define BOOST_AUTO_FUNCTION_MAX_REQUIRES_EXPRESSIONS 20
+#endif
+
+#endif // BOOST_AUTO_FUNCTION_LIMITS_HPP

Added: sandbox/auto_function/boost/auto_function/support.hpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/boost/auto_function/support.hpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,101 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#ifndef BOOST_AUTO_FUNCTION_SUPPORT_HPP
+#define BOOST_AUTO_FUNCTION_SUPPORT_HPP
+
+#include <boost/config.hpp>
+
+// ToDo: Remove this, add such a macro to Boost.Config
+// Currently no compilers support this feature
+#define BOOST_NO_LAMBDA_IN_RETURN_TYPE
+
+// The base requirements for BOOST_AUTO_FUNCTION
+// (should probably add extended SFINAE check as well)
+#if !( defined( BOOST_NO_DECLTYPE ) \
+ && defined( BOOST_NO_TRAILING_RETURN_TYPE ) \
+ && defined( BOOST_NO_VARIADIC_MACROS ) \
+ )
+
+#include <boost/auto_function/detail/is_recognized_arg.hpp>
+#include <boost/auto_function/detail/param_id.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+
+#if 0
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_IMPL_UNREC(param_id) 1
+
+// ToDo: Possibly produce error here if not recognized instead of yielding 1
+#define BOOST_NO_BOOST_AUTO_FUNCTION_PARAM( param_id ) \
+BOOST_PP_IIF( BOOST_AUTO_FUNCTION_DETAIL_IS_RECOGNIZED_ARG( ( param_id ) ) \
+ , BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_IMPL \
+ , BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_IMPL_UNREC \
+ )( param_id )
+
+
+#else
+
+#define BOOST_NO_BOOST_AUTO_FUNCTION_PARAM( param_id ) \
+BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_IMPL( param_id )
+
+#endif
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_IMPL( param_id ) \
+BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_ ## param_id
+
+// "auto explicit" isn't implemented yet for any compiler
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_auto_explicit 1
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_auto_if 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_auto_not 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_explicit 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_if 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_not 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_return 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_return_ref 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_return_value 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_try 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_virtual_explicit 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_void 0
+
+#ifndef BOOST_NO_RVALUE_REFERENCES // If rvalue references are supported
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_return_rvalue_ref 0
+#else // Else, rvalue references are not supported
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_return_rvalue_ref 1
+#endif // End rvalue reference support check
+
+// If we can use lambda functions in the return type
+#ifndef BOOST_NO_LAMBDA_IN_RETURN_TYPE
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_auto_try 0
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_do 0
+
+#else // Else, lambda functions in the return type are not supported
+
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_auto_try 1
+#define BOOST_AUTO_FUNCTION_DETAIL_NO_AUTO_FUNCTION_PARAM_do 1
+
+#endif // End lambda in return type check
+
+#else // Else, BOOST_AUTO_FUNCTION isn't supported
+
+#define BOOST_NO_BOOST_AUTO_FUNCTION
+
+// Nothing is supported
+#define BOOST_NO_BOOST_AUTO_FUNCTION_PARAM( arg ) 1
+
+#endif // End BOOST_AUTO_FUNCTION support check
+
+// BOOST_BASIC_AUTO_FUNCTION requires do support
+#if BOOST_NO_BOOST_AUTO_FUNCTION_PARAM( do )
+
+#define BOOST_NO_BOOST_BASIC_AUTO_FUNCTION
+
+#endif
+
+#endif // BOOST_AUTO_FUNCTION_SUPPORT_HPP

Added: sandbox/auto_function/libs/auto_function/doc/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/Jamfile 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,28 @@
+#===============================================================================
+# 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)
+#===============================================================================
+project boost/libs/auto_function/doc ;
+import boostbook : boostbook ;
+using quickbook ;
+
+path-constant images_location : html ;
+
+boostbook quickbook
+ :
+ auto_function.qbk
+ :
+ <xsl:param>boost.root=../../../..
+ <xsl:param>chunk.section.depth=4
+ <xsl:param>chunk.first.sections=1
+ <xsl:param>toc.section.depth=3
+ <xsl:param>toc.max.depth=3
+ <xsl:param>generate.section.toc.level=4
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/auto_function/doc/html
+ <format>pdf:<xsl:param>img.src.path=$(images_location)/
+ ;
+
+

Added: sandbox/auto_function/libs/auto_function/doc/acknowledgements.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/acknowledgements.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,17 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Acknowledgements]
+
+The author would like to thank those in the Boost community who showed interest
+and provided suggestions during development. In particular, thanks to Dave
+Abrahams for providing the idea of prefering keywords for the parameter IDs and
+Dean Michael Berris for influencing interface changes to
+__boost_auto_function_macro__.
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/auto_function.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/auto_function.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,85 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[library Boost.Auto_Function
+ [quickbook 1.5]
+ [authors [Calabrese, Matt]]
+ [copyright 2010 Matt Calabrese]
+ [purpose Function Templates with Automatically Deduced Return Types and User-Specified Requirements]
+ [license
+ 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])
+ ]
+]
+
+[/
+[def __boost_type_traits__ [@boost:/libs/type_traits/index.html =Boost.Type_Traits=]]
+[def __boost_mpl__ [@boost:/libs/mpl/index.html =Boost.MPL=]]
+[def __boost_preprocessor__ [@boost:/libs/preprocessor/doc/index.html =Boost.Preprocessor=]]
+[def __boost_preprocessor_sequence__ [@boost:/libs/preprocessor/doc/data/sequences.html =Boost.Preprocessor= Sequence]]
+[def __boost_mpl_lambda_expression__ [@boost:/libs/mpl/doc/refmanual/lambda-expression.html =Boost.MPL= Lambda Expression]]
+[def __boost_mpl_metafunction__ [@boost:/libs/mpl/doc/refmanual/metafunction.html =Boost.MPL= Metafunction]]
+[def __boost_enable_if__ [@boost:/libs/utility/enable_if.html =Boost.Enable_If=]]
+[def __boost_concept_check__ [@boost:/libs/concept_check/concept_check.htm =Boost.Concept_Check=]]
+[def __boost_parameter__ [@boost:/libs/parameter/doc/html/index.html =Boost.Parameter=]]
+[def __boost_range__ [@boost:/libs/range/doc/html/index.html =Boost.Range=]]
+[def __boost_range_begin__ [@boost:/libs/range/doc/html/range/concepts/single_pass_range.html#range.concepts.single_pass_range.valid_expressions =Boost.Range= `begin`]]
+[def __boost_range_range__ [@boost:/libs/range/doc/html/range/concepts/overview.html =Boost.Range= Range]]
+]
+
+[def __boost_type_traits__ [@http://www.boost.org/libs/type_traits/index.html =Boost.Type_Traits=]]
+[def __boost_mpl__ [@http://www.boost.org/libs/mpl/index.html =Boost.MPL=]]
+[def __boost_preprocessor__ [@http://www.boost.org/libs/preprocessor/doc/index.html =Boost.Preprocessor=]]
+[def __boost_preprocessor_sequence__ [@http://www.boost.org/libs/preprocessor/doc/data/sequences.html =Boost.Preprocessor= Sequence]]
+[def __boost_mpl_lambda_expression__ [@http://www.boost.org/libs/mpl/doc/refmanual/lambda-expression.html =Boost.MPL= Lambda Expression]]
+[def __boost_mpl_metafunction__ [@http://www.boost.org/libs/mpl/doc/refmanual/metafunction.html =Boost.MPL= Metafunction]]
+[def __boost_enable_if__ [@http://www.boost.org/libs/utility/enable_if.html =Boost.Enable_If=]]
+[def __boost_concept_check__ [@http://www.boost.org/libs/concept_check/concept_check.htm =Boost.Concept_Check=]]
+[def __boost_parameter__ [@http://www.boost.org/libs/parameter/doc/html/index.html =Boost.Parameter=]]
+[def __boost_range__ [@http://www.boost.org/libs/range/doc/html/index.html =Boost.Range=]]
+[def __boost_range_begin__ [@http://www.boost.org/libs/range/doc/html/range/concepts/single_pass_range.html#range.concepts.single_pass_range.valid_expressions =Boost.Range= `begin`]]
+[def __boost_range_range__ [@http://www.boost.org/libs/range/doc/html/range/concepts/overview.html =Boost.Range= Range]]
+
+[def __boost_auto_function__ [link boost_auto_function =Boost.Auto_Function=]]
+[def __checking_support__ [link boost_auto_function.checking_support Checking Support]]
+[def __future_direction__ [link boost_auto_function.future_direction Future Direction]]
+[def __boost_auto_function_macro__ [link boost_auto_function.the__boost_auto_function__macro `BOOST_AUTO_FUNCTION`]]
+[def __boost_basic_auto_function_macro__ [link boost_auto_function.the__boost_basic_auto_function__macro `BOOST_BASIC_AUTO_FUNCTION`]]
+
+[heading Brief Description]
+
+__boost_auto_function__ is a library focused on making it simple for programmers
+to express functions and function declarations that have an automatically
+deduced return type and to provide a way to place arbitrary compile-time
+requirements on a function's signature.
+
+[include preface.qbk]
+[include support.qbk]
+[include tutorials.qbk]
+[include boost_basic_auto_function.qbk]
+[include boost_auto_function.qbk]
+[include checking_support.qbk]
+[include rationale.qbk]
+[include future_direction.qbk]
+[include acknowledgements.qbk]
+[/
+[:['["Creativity is making the complicated simple.]]]
+[:*--Charles Mingus*]
+
+[:['["Always listen to the experts. They'll tell you what can't be done and why. Then do it.]]]
+[:*--Robert A. Heinlein*]
+
+[:['["Comments lie. Code doesn't.]]]
+[:*--Ron Jeffries*]
+
+[:['["A language that doesn't affect the way you think about programming, is not worth knowing.]]]
+[:*--Alan Perlis*]
+
+[:['["Within C++, there is a much smaller and cleaner language struggling to get out.]]]
+[:*--Bjarne Stroustrup*]]

Added: sandbox/auto_function/libs/auto_function/doc/boost_auto_function.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/boost_auto_function.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,16 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section The `BOOST_AUTO_FUNCTION` Macro]
+
+[include boost_auto_function/overview.qbk]
+[include boost_auto_function/named_parameters.qbk]
+[include boost_auto_function/combining_do_and_explicit.qbk]
+[include boost_auto_function/separating_declaration_from_implementation.qbk]
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/boost_auto_function/combining_do_and_explicit.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/boost_auto_function/combining_do_and_explicit.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,55 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Combining `do` and `explicit`]
+
+[heading The "Problem"]
+
+*The purpose of an argument to __boost_auto_function_macro__ from the `explicit`
+category is to explicitly specify the return type of a function
+
+*The purpose of an argument from the `do` category is to provide a function body
+and automatically deduce the return type
+
+At first, there may seem to be a conflict here when both an `explicit` argument
+and a `do` argument appear in a single invocation since they both provide the
+function with a return type, but there is actually a special case for this very
+scenerio.
+
+[heading Behavior]
+
+The behavior that results when both categories of arguments appear is that the
+`explicit` argument is used and what would be the `do` argument's deduced return
+type will now just be checked for conversion to the explicitly specified return
+type. If there is no valid conversion then substitution will fail (or it will
+directly produce an error if the check is not dependent on a template
+parameter).
+
+For example, see the code below.
+
+ #include <boost/auto_function/auto_function.hpp>
+ #include <iostream>
+
+ // There is no conflict here because the type of &arg is T*
+ // (unless unary operator& is overloaded, in which case substitution may fail)
+ template< class T >
+ BOOST_AUTO_FUNCTION
+ ( ( foo( T arg ) )
+ , ( explicit T* )
+ , ( return &arg )
+ )
+
+ // Here substitution will fail when called because the types conflict
+ template< class T >
+ BOOST_AUTO_FUNCTION
+ ( ( bar( T arg ) )
+ , ( explicit T )
+ , ( return std::cout << arg )
+ )
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/boost_auto_function/named_parameters.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/boost_auto_function/named_parameters.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,119 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Named Parameters]
+
+The following is a series of tables that specifies all of the parameter types
+currently supported by __boost_auto_function_macro__ and how they are used. No
+two parameters from the same category may be used with the same macro
+invocation. At least one argument of either the `do` category or the `explicit`
+category must be passed for any given invocation to be valid.
+
+When refering to examples in the following table, assume that the
+__boost_auto_function_macro__ invocation begins as
+
+ template< class L, class R >
+ BOOST_AUTO_FUNCTION( ( foo( L& left, R right ) ),
+
+and that both __boost_type_traits__ and __boost_mpl__ are included and their
+namespaces have been introduced via a using declaration.
+
+[table "do" category parameters
+[[Parameter ID][Purpose][Argument Kind][Example]]
+[[`do`]
+[To provide a body for a function with multiple statements, often used for
+automatic return type deduction and SFINAE (uses C++0x lambda function rules and
+restrictions)]
+[Statements that would appear in the function's body]
+[``
+ ( do
+ if( left == right )
+ do_something();
+ else
+ do_something_else();
+ )
+
+ ``]
+]
+[[`return`]
+[To provide a body for a 1-line function consisting of a return statement, often
+used for automatic return type deduction and SFINAE]
+[An expression that would appear in the function's return statement]
+[``( return left + right )``]]
+[[`return_ref`]
+[Same as `return` but forces the automatically deduced return type to be an
+lvalue reference type]
+[An expression that would appear in the function's return statement]
+[``( return_ref left += right )``]]
+[[`return_rvalue_ref`]
+[Same as `return` but forces the automatically deduced return type to be an
+rvalue reference type]
+[An expression that would appear in the function's return statement]
+[``( return_rvalue_ref left += right )``]]
+[[`return_value`]
+[Same as `return` but forces the automatically deduced return type to not be a
+reference type]
+[An expression that would appear in the function's return statement]
+[``( return_value left + right )``]]
+[[`void`]
+[To provide an expression that would appear in a statement in the body of a
+function with the return type `void`, often used for SFINAE]
+[An expression that would appear in a statement in the function's body]
+[``( void left + right )``]]
+]
+
+[table "if" category parameters
+[[Parameter ID][Purpose][Argument Kind][Example]]
+[[`if`]
+[To require that a given predicate yields `true`]
+[ nullary __boost_mpl_metafunction__ type ['*or*] compile-time bool value]
+[``( if is_arithmetic< L >::value && is_arithmetic< R >::value )``]]
+[[`not`]
+[To require that a given predicate yields `false`]
+[ nullary __boost_mpl_metafunction__ type ['*or*] compile-time bool value]
+[``( not is_same< L, R > )``]]
+]
+
+[table "try" category parameters
+[[Parameter ID][Purpose][Argument Kind][Example]]
+[[`try`]
+[To specify expressions that must be valid for substitution to succeed]
+[ __boost_preprocessor_sequence__ of expressions ]
+[``( try (left + right)(left - right)(-left) )``]]
+]
+
+[table "explicit" category parameters
+[[Parameter ID][Purpose][Argument Kind][Example]]
+[[`explicit`]
+[To provide an explicit return type for the function]
+[ type ]
+[``( explicit L )``]]
+[[`virtual explicit`]
+[To provide an explicit return type for the function]
+[ nullary __boost_mpl_metafunction__ type ]
+[``( virtual explicit add_pointer< L > )``]]
+[/[[`auto explicit`]
+[To provide a return type that is specified as a transformation of a deduced
+return type (requires an argument from the `do` category to also be present)]
+[ unary __boost_mpl_lambda_expression__ ]
+[``( auto explicit integral_promotion< _1 > )``]]]
+]
+
+[table "auto if" category parameters
+[[Parameter ID][Purpose][Argument Kind][Example]]
+[[`auto if`]
+[To require that a return type matches a given predicate]
+[ unary __boost_mpl_lambda_expression__ ]
+[``( auto if is_same< L, _1 > )``]]
+[[`auto not`]
+[To require that a return type /does not/ match a given predicate]
+[ unary __boost_mpl_lambda_expression__ ]
+[``( auto not is_arithmetic< _1 > )``]]
+]
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/boost_auto_function/overview.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/boost_auto_function/overview.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,56 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Overview]
+
+Central to the design of __boost_auto_function__ is the named parameter
+interface to the __boost_auto_function_macro__ macro. The overall goal of this
+design is to provide users with one macro that augments declarations differently
+depending on which arguments are given. Arguments passed to the macro in this
+way may appear in any order, meaning that users may leave off any parameters
+they wish. It also makes it easy for future versions of the library to add even
+more parameter types without breaking existing code (see
+"__future_direction__").
+
+The basic format of a __boost_auto_function_macro__ invocation is as follows.
+
+ BOOST_AUTO_FUNCTION
+ ( ( ``/function_name/``( ``/function_parameters/`` ) ``/specifiers/`` )
+ , ( ``/named_parameter_id argument/`` )
+ ``/.../``
+ )
+
+Any number of named parameters may be passed to the macro as long as they do not
+conflict with previously specified parameters. For example, the following is a
+__boost_auto_function_macro__ invocation that creates a function template that
+uses several named parameters which will be elaborated on later in this section.
+
+ template< typename T >
+ BOOST_AUTO_FUNCTION
+ ( ( foo( T arg ) )
+ , ( try (arg++) )
+ , ( auto if is_integral< _1 > )
+ , ( return arg-- )
+ )
+
+In this contrived example, the function template `foo` has one function
+parameter and uses three named macro parameters: a `try`, an `auto if`, and a
+`return`. A `try` macro argument is a __boost_preprocessor_sequence__ of
+expressions and forces substitution to fail when such an expression would not
+compile. An `auto if` macro argument is a unary __boost_mpl_lambda_expression__
+that is invoked with the return type of the function and forces substitution to
+fail if the result is false. A `return` macro argument is an expression that
+will be used in the return statement of the function template and that will be
+used to deduce the return type in cases where one is not explicitly specified.
+
+So, the above code example creates a unary function template called foo that
+will be usable with arguments that support the postfix form of `operator++` and
+requires that the return type is an =integral= type. The function itself simply
+returns the result of `arg--` and automatically deduces the return type.
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/boost_auto_function/separating_declaration_from_implementation.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/boost_auto_function/separating_declaration_from_implementation.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,56 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Separating Declaration from Implementation]
+
+In the most general sense, it is impossible to separate a function or function
+template declaration from its implementation in cases where the return type is
+deduced because the declaration must have some kind of specified return type at
+the point of its declaration. However, not all uses of
+__boost_auto_function_macro__ imply an automatically deduced return type.
+Specifically, when an argument from the `explicit` category is used, the macro
+has enough information to yield a return type.
+
+An example of the separation of declaration and implementation can be seen here.
+
+ #include <boost/auto_function/auto_function.hpp>
+ #include <boost/type_traits/add_pointer.hpp>
+ #include <boost/type_traits/is_pointer.hpp>
+
+ // The declaration
+ template< class T >
+ BOOST_AUTO_FUNCTION
+ ( ( foo( T arg ) )
+ , ( not boost::is_pointer< T > )
+ , ( virtual explicit boost::add_pointer< T > )
+ );
+
+ // The implementation
+ template< class T >
+ BOOST_AUTO_FUNCTION
+ ( ( foo( T arg ) )
+ , ( not boost::is_pointer< T > )
+ , ( virtual explicit boost::add_pointer< T > )
+ )
+ {
+ return &arg;
+ }
+
+Notice that both the macro invocation that appears with the declaration and the
+one that appears with the definition are the same. The function body is /not/ a
+`do` argument to the macro. This is very important since making changes to the
+macro arguments will result in a different declaration entirely, meaning that
+the definition would be of an entirely separate function template than the one
+that was declared.
+
+[note You cannot separate the declaration of a __boost_auto_function_macro__
+from its implementation in any case where an argument from the `do` category is
+present, regardless of whether or not an argument from the `explicit` category
+was passed.]
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/boost_basic_auto_function.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/boost_basic_auto_function.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,54 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section The `BOOST_BASIC_AUTO_FUNCTION` Macro]
+
+[warning No known compilers currently support
+__boost_basic_auto_function_macro__. For the time being, please use
+__boost_auto_function_macro__ instead.]
+
+[heading Description]
+
+When it comes down to it, the main purpose of __boost_auto_function__ is to allow
+programmers to write functions and function templates that have an automatically
+deduced return type in the same way that a C++0x lambda functions does. The
+__boost_basic_auto_function_macro__ macro is the most concise way to get this
+functionality without any extra boilerplate. The drawback of this simplicity is
+that it is not capable of directly handling __boost_enable_if__-style
+requirements. If such features are desired, the __boost_auto_function_macro__
+macro should be used instead.
+
+[heading Headers]
+
+ #include <boost/auto_function/basic_auto_function.hpp>
+
+ // Or, for the entire library including BOOST_BASIC_AUTO_FUNCTION
+ #include <boost/auto_function.hpp>
+
+[heading Synopsis]
+
+ #define BOOST_BASIC_AUTO_FUNCTION( ... ) /* implementation-defined */
+
+[heading Usage]
+
+Usage of the macro should be fairly intuitive. The argument to the macro is the
+function name and parameter list, along with any specifiers that may follow the
+parameter list. Immediately following the invocation of the macro should be a
+parenthesized function body.
+
+The rules for return type deduction are the same as those for C++0x lambda
+functions. In particular, the return type of the function is deduced /if and
+only if/ the function consists of exactly one line and that line is a return
+statement. Multi-line functions are resolved to have the return type `void`.
+When the declaration is a template, errors that would normally appear in the
+function body will instead cause substitution to fail.
+
+[import ../example/square.cpp]
+[square]
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/checking_support.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/checking_support.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,84 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Checking Support]
+
+[heading Headers]
+
+ // For just support checking
+ #include <boost/auto_function/support.hpp>
+
+ // For the entire library (including support checking)
+ #include <boost/auto_function.hpp>
+
+[heading `BOOST_BASIC_AUTO_FUNCTION` Support]
+
+To check at preprocessor-time if your compiler is capable of supporting
+__boost_basic_auto_function_macro__, verify that
+`BOOST_NO_BOOST_BASIC_AUTO_FUNCTION` is not defined after including one of the
+headers specified above. If a programmer does not check for support, the library
+will do its best to emit a readable error message explaining why it is not
+supported upon the first invocation of the macro.
+
+For example:
+
+ #include <boost/auto_function/support.hpp>
+
+ #ifndef BOOST_NO_BOOST_BASIC_AUTO_FUNCTION
+ // Code to preprocess when support is available
+ #else
+ // Code to preprocess when support is not available
+ #endif
+
+[heading Top-Level `BOOST_AUTO_FUNCTION` Support]
+
+To check at preprocessor-time if your compiler is capable of supporting
+__boost_auto_function_macro__ in at least a trivial form, verify that
+`BOOST_NO_BOOST_AUTO_FUNCTION` is not defined after including one of the headers
+specified above. If a programmer does not check for support, the library will do
+its best to emit a readable error message explaining why it is not supported
+upon the first invocation of the macro.
+
+For example:
+
+ #include <boost/auto_function/support.hpp>
+
+ #ifndef BOOST_NO_BOOST_AUTO_FUNCTION
+ // Code to preprocess when support is available
+ #else
+ // Code to preprocess when support is not available
+ #endif
+
+[heading `BOOST_AUTO_FUNCTION` Individual Parameter Support]
+
+While a compiler may be able to handle some features of
+__boost_auto_function_macro__, it may not be able to handle them all. In order
+to check at preprocessor-time which parameter kinds are supported, a programmer
+may use the `BOOST_NO_BOOST_AUTO_FUNCTION_PARAM` macro by passing in the
+parameter ID of the parameter kind for which he or she wishes to determine
+whether or not there is support. When the parameter kind is supported, the macro
+invocation will yield `0`, otherwise it will yield `1`.
+
+For instance, to branch at preprocessor-time based on whether or not the `do`
+parameter kind is supported, code similar to the following may be used.
+
+ #include <boost/auto_function/support.hpp>
+
+ #if !BOOST_NO_BOOST_AUTO_FUNCTION_PARAM( do )
+ // Code preprocessed when "do" is supported
+ #else
+ // Code preprocessed when "do" is not supported
+ #endif
+
+Much like with `BOOST_NO_BOOST_AUTO_FUNCTION`, if a programmer does not
+explicitly check for support before using a particular parameter kind, the
+library will do its best to produce a readable error message during compilation
+in cases where the feature is used but not supported.
+
+[endsect]
+

Added: sandbox/auto_function/libs/auto_function/doc/future_direction.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/future_direction.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,35 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Future Direction]
+
+[heading Parameters]
+
+Some additional parameter kinds are planned for __boost_auto_function_macro__,
+including
+
+* A series of `break` categories that would `static_assert` when requirements
+are not met as opposed to force substitution to fail
+
+* An `auto try` parameter that would allow a programmer to check that instances
+of a function's return type could be used in specified expressions
+
+* An `auto explicit` parameter that would allow a programmer to apply a
+transformation to a deduced return type
+
+[heading Generic Programming]
+
+During the development of __boost_auto_function__ it became apparent that with
+some further effort, __boost_auto_function_macro__ and macros similar to it
+could be made to be more powerful replacements for many of the features of
+__boost_concept_check__. In particular, such macros may be used for specifying
+concept requirements and even allow for concept-based function template
+overloads. In releases to come, __boost_auto_function__ will likely introduce such
+functionality and may even spawn off a new version of __boost_concept_check__.
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/preface.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/preface.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Preface]
+
+[include preface/description.qbk]
+[include preface/motivation.qbk]
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/preface/description.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/preface/description.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,35 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Description]
+
+[:['["Creativity is making the complicated simple.]]]
+[:*--Charles Mingus*]
+
+When writing code in C++, programmers are often forced to exploit the language
+in strange, unconventional ways in order to create powerful and expressive
+programs, metaprograms, and interfaces, especially when developing libraries.
+Several components of Boost exist for the sole purpose of formalizing these
+exploits and turning them into directly supported features.
+__boost_auto_function__ is one of those libraries as it aims to provide a way of
+specifying functions and function templates in a manner that allows the
+programmer to include metafunction requirements, expression requirements, and
+get automatic return type deduction. This is accomplished through a tricky mix
+of preprocessor metaprogramming, template metaprogramming, and the use of many
+C++0x features already supported by some compilers. The interface to the library
+is primarily done through a variadic macro called __boost_auto_function_macro__
+that receives "named parameters," similar to __boost_parameter__ functions, to
+which programmers may pick and choose from a variety of powerful ways to enhance
+their declarations.
+
+As far as macros are concerned, __boost_auto_function_macro__ is (or at least
+tries to be) fairly sophisticated and attempts to catch as many user errors as
+possible, producing easy-to-read messages when used incorrectly or when certain
+features are not supported by a given compiler.
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/preface/motivation.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/preface/motivation.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,113 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Motivation]
+
+The importance of automatic type deduction is already well understood by the C++
+community, particularly when working with templates, and because of this, C++0x
+has introduced at least three new ways of deducing types. First, the keyword
+`decltype` has been introduced as a way to retrieve the type of a given
+expression. Second, the old use of the keyword `auto` has been removed and the
+name has been recycled as a way to deduce the type in an object declaration
+based on the expression that appears during its initialization. Finally, C++0x
+lambda functions have basic rules for automatically deducing their return type
+based on the statements in their body.
+
+However, despite these new facilities, there is still no simple way to get
+automatic return type deduction for functions in the more general sense nor for
+function templates at all. Consider the following hypothetical function
+template.
+
+ template< class LeftType, class RightType >
+ ``/???/`` add( LeftType const& left, RightType const& right )
+ {
+ return left + right;
+ }
+
+In the above code example, what should the return type be? Should it be
+`LeftType`? Should it be `RightType`? Should it be something else entirely?
+
+The problem, of course, is that we don't know what the return type should be
+because it is dependent on the types of `left` and `right` and how the
+associated binary `operator+` is defined, if at all. When `left` and `right`
+are both integers, C++ integral promotion rules must be used to determine the
+exact result type. When one operand is a pointer type and the other is an
+integer, the result type is that of the original pointer, given that the
+operation is defined at all. When `left` or `right` is a user-defined type and
+`operator+` is overloaded, the result could be one of any number of types.
+
+Thankfully, C++0x introduces a new way of declaring functions that aids
+programmers in solving this problem by allowing them to specify the return type
+/after/ the parameter list, meaning that the parameter names may be used as
+objects when forming the return type. The benefit of such a trailing return type
+is that it allows a programmer to write an expression involving the function's
+parameters, wrapped in `decltype`, as a way of determining the exact type that
+is needed. In C++0x, the above code example may be written as follows.
+
+ template< class LeftType, class RightType >
+ auto add( LeftType const& left, RightType const& right )
+ -> decltype( left + right )
+ {
+ return left + right;
+ }
+
+While this solves the problem of specifying the proper return type, it
+introduces redundancy since the expression `left + right` must be repeated.
+Unfortunately, function templates such as the one above are extremely common,
+especially in libraries. __boost_auto_function__ solves this problem via a macro
+that internally generates the proper return type so that the programmer does not
+have to introduce redundancy into his or her own code. With the library, the
+equivalent function template may be written as follows.
+
+ template< class LeftType, class RightType >
+ BOOST_BASIC_AUTO_FUNCTION( add( LeftType const& left, RightType const& right ) )
+ (
+ return left + right;
+ )
+
+The programmer is now relieved of having to explicitly specify any return type
+at all as it is completely pulled from the return expression.
+
+[heading Further Motivation]
+
+...but __boost_auto_function__ doesn't simply provide a means for creating
+functions and function templates with automatically deduced return types. It
+also provides mechanisms for checking arbitrary compile-time requirements on
+parameters and on a function's return type, whether those types be deduced or
+explicit.
+
+Consider again the example `add` function template and imagine that we wish to
+limit the parameter types to be C++ =integral= types. __boost_enable_if__
+provides some support for this functionality by exploiting SFINAE
+(Substitution-Failure-Is-Not-An-Error), however its return type form is not
+directly usable with __boost_basic_auto_function_macro__ when that type is
+deduced since no explicit return type ever appears directly in user code. As
+well, C++0x extended SFINAE rules make it possible, though not always simple, to
+force substitution to fail when arbitrary expressions in the return type or
+parameter list would fail to compile had they not been dependent on template
+arguments. __boost_enable_if__ does not directly support a way to check such
+expressions, making its use slightly limited in C++0x. In contrast,
+__boost_auto_function__ makes checking such conditions on types and expressions a
+trivial task by introducing named parameters to the macro used exclusively for
+such purposes.
+
+The following code presents, once again, an `add` function template, only now in
+a way that will force substitution to fail when `left` or `right` is not an
+=integral= type.
+
+ template< class LeftType, class RightType >
+ BOOST_AUTO_FUNCTION
+ ( ( add( LeftType const& left, RightType const& right ) )
+ , ( if is_integral< LeftType >::value && is_integral< RightType >::value )
+ , ( return left + right )
+ )
+
+Uses exceed those presented in this section and are detailed later on in this
+documentation.
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/rationale.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/rationale.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,28 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Rationale]
+
+[heading Keyword Parameter IDs]
+
+Most of the parameter IDs used in this library are C++ keywords by design. This
+is something that happened after a couple of early iterations of the library due
+to a suggestion by Dave Abrahams. Prior to using the keyword `if` as a parameter
+ID, `requires` was used in order to mimic the ill-fated feature of C++0x.
+Similarly, there was `requires_expr` instead of `try`. The problem with this
+approach is that it becomes very easy to misspell the parameter IDs since IDEs
+will not highlight them as keywords when spelled correctly. Common typos such as
+`require` or `required` would be very difficult to check for from within the
+macro due to its nature of being a preprocessor utility (though with some
+effort, these common misspellings were detected in a way that complicated the
+implementation). The compromise of using keywords wherever possible makes it
+less likely that programmers will attempt to compile code with such mistakes,
+makes the IDs stand out when reading the code, and implies fewer "magic words"
+for programmers to remember.
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/support.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/support.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,31 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Support]
+
+__boost_auto_function__ is a C++0x library and therefore requires a compiler
+that has some minimal C++0x support with such features enabled. In particular,
+the following are base requirements to use the library's primary macro,
+__boost_auto_function_macro__.
+
+* `decltype`
+
+* trailing-return-type
+
+* variadic macros
+
+[important
+
+Further C++0x support is required to use the more complicated features of the
+library. If you would like to test at preprocessor-time whether or not a given
+feature of the library is supported by your compiler with its current options,
+please refer to the section "__checking_support__".
+
+]
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/tutorials.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/tutorials.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,15 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Tutorials]
+
+[include tutorials/first.qbk]
+[include tutorials/multi_cast.qbk]
+[include tutorials/last.qbk]
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/tutorials/first.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/tutorials/first.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,105 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section First (Beginner)]
+
+[heading Library Features Used]
+
+* The __boost_basic_auto_function_macro__ macro (an alternate implementation uses
+__boost_auto_function_macro__)
+
+* Extended SFINAE as applied to the function body
+
+[heading C++0x Features Used]
+
+* Extended SFINAE
+
+[heading Introduction]
+
+In this tutorial, we will walk through a very basic function template that takes
+a __boost_range_range__ and returns the first element.
+
+[heading Implementation without =Boost.Auto_Function=]
+
+Before going into how this function template will be implemented using
+__boost_auto_function__, let's see what it would look like without it (for the
+exact source code, refer to
+[@boost:libs/auto_function/example/first/no_auto_function_first.cpp
+example/first/no_auto_function_first.cpp]).
+
+[import ../example/first/no_auto_function_first.cpp]
+[no_auto_function_first]
+
+In order to specify the correct return type for the function, we must pull in
+a metafunction from __boost_range__ and apply it with our `RangeType`. While not
+horribly complicated, it is still a source for error and requires knowledge of
+the metafunctions of __boost_range__ to simply get the first element. This is
+frustrating since the compiler already knows the type of the expression in the
+return statement and it would be nice if it just used that for the return type
+of the function automatically.
+
+[heading Implementation with =Boost.Auto_Function=]
+
+[warning No known compilers yet support this implementation. To see one that is
+usable, scroll down to the alternate implementation.]
+
+Now let's see what such a function template would look like when using
+__boost_auto_function__. For this implementation, automatic return type
+deduction will be used along with SFINAE as applied to the expression in the
+function body (for the exact source code, refer to
+[@boost:libs/auto_function/example/first/basic_auto_function_first.cpp
+example/first/basic_auto_function_first.cpp]).
+
+[import ../example/first/basic_auto_function_first.cpp]
+[basic_auto_function_first]
+
+With this implementation we have no need to call a metafunction to retrieve the
+return type of the function since it is deduced automatically.
+
+Walking through the code, we have the headers required to pull in the
+__boost_basic_auto_function_macro__ macro as well as the header required to pull
+in the __boost_range_begin__ function template. The
+__boost_basic_auto_function_macro__ macro is used by passing in the function
+name and parameter list. Immediately following the invocation, a body for the
+function is provided as surrounded by parentheses.
+
+When using the __boost_basic_auto_function_macro__ macro, the function body is
+restricted in the same way that C++0x lambda functions are restricted. In
+particular, the return type is deduced as a non-void type /if and only if/ the
+function consists of exactly one statement which is a return statement.
+For multi-line functions the return type will be `void`.
+
+[important Look carefully at the implementation and notice that curly-braces are
+not used to surround the function body, but rather, parentheses appear instead.]
+
+[heading Alternate Implementation with =Boost.Auto_Function=]
+
+Unfortunately, at this point in time no known compilers are able to support the
+above implementation. Instead, we must use one that appears to be slightly more
+complicated (for the exact source code, refer to
+[@boost:libs/auto_function/example/first/auto_function_first.cpp
+example/first/auto_function_first.cpp]).
+
+[import ../example/first/auto_function_first.cpp]
+[auto_function_first]
+
+Once again, we include the appropriate headers required for our implementation.
+Now, however, the macro __boost_auto_function_macro__ is used instead of
+__boost_basic_auto_function_macro__. This new macro is actually more versatile,
+but its use appears to be slightly more complicated. It is variadic and takes
+several optional, named arguments that may appear in any order, though for this
+example we will use it to simply get automatic return type deduction and SFINAE.
+
+Examining the implementation more closely, the first argument is the function
+template name and its parameter list, all surrounded by an extra set of
+parentheses. For our second argument, which is again parenthesized, there is the
+keyword `return` followed by an expression that would appear in the return
+statement of the function body. Because this is an expression as opposed to a
+statement, it must not end in a semicolon.
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/doc/tutorials/last.qbk
==============================================================================

Added: sandbox/auto_function/libs/auto_function/doc/tutorials/multi_cast.qbk
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/doc/tutorials/multi_cast.qbk 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,124 @@
+[/==============================================================================
+ 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)
+==============================================================================/]
+
+[section Multi-Cast (Intermediate)]
+
+[heading Library Features Used]
+
+* The __boost_basic_auto_function_macro__ macro (an alternate implementation
+uses __boost_auto_function_macro__)
+
+* Extended SFINAE as applied to the function body
+
+[heading C++0x Features Used]
+
+* Extended SFINAE
+
+* Variadic templates
+
+* RValue references
+
+* `std::forward`
+
+[heading Introduction]
+
+In this tutorial, we will walk through the development of a `multi_cast`
+function template. The purpose of this template is to simplify the calling of
+several successive `static_cast` operations, such as for cross-casting between
+the bases of a type that is not =abstract=.
+
+[heading Implementation without =Boost.Auto_Function=]
+
+Let's see how such a macro would look without __boost_auto_function__ (for the
+exact source code, refer to
+[@boost:libs/auto_function/example/multi_cast/no_auto_function_multi_cast.cpp
+example/multi_cast/no_auto_function_multi_cast.cpp]).
+
+[import ../example/multi_cast/no_auto_function_multi_cast.cpp]
+[no_auto_function_multi_cast]
+
+The exact series of messages that GCC 4.5.1 produces may be seen below.
+
+ main.cpp: In function 'TargetType multi_cast(SourceType&&) [with TargetType = right&, IntermediateTypes = {unrelated_type&, child&}, SourceType = left&]':
+ main.cpp:49:73: instantiated from here
+ main.cpp:22:11: error: invalid static_cast from type 'unrelated_type' to type 'right&'
+ main.cpp: In function 'TargetType multi_cast(SourceType&&) [with TargetType = unrelated_type&, IntermediateTypes = {child&}, SourceType = left&]':
+ main.cpp:22:11: instantiated from 'TargetType multi_cast(SourceType&&) [with TargetType = right&, IntermediateTypes = {unrelated_type&, child&}, SourceType = left&]'
+ main.cpp:49:73: instantiated from here
+ main.cpp:22:11: error: invalid static_cast from type 'child' to type 'unrelated_type&'
+ main.cpp: In function 'TargetType multi_cast(SourceType&&) [with TargetType = right&, IntermediateTypes = {unrelated_type&, child&}, SourceType = left&]':
+ main.cpp:23:2: warning: control reaches end of non-void function
+
+What a mess! While an experienced C++ programmer will be able to determine the
+problem from such messages, one not as familiar with templates may struggle.
+These types of errors are one reason why many people get frustrated with C++.
+
+What makes these errors so terrible? Most prominent is the fact that a single,
+simple user mistake has produced 9 separate lines in the build log, with only
+2 of those lines even pointing to the programmer's own code (and those lines are
+"instantiated from" messages, not the errors themselves). At first glance, it's
+not even clear that the problem is with user code since most of the log points
+to the innards of a `multi_cast` template. Upon further examination, a
+programmer should hopefully notice that the errors contain the text `invalid
+static_cast` and from that figure out that they provided a type that would imply
+an invalid conversion.
+
+Certainly, though, we must be able to do better, and we can.
+
+[heading Implementation with =Boost.Auto_Function=]
+
+[warning No known compilers yet support this implementation. To see one that is
+usable, scroll down to the alternate implementation.]
+
+For this function template, automatic return type deduction is a convenience,
+however, the main advantage of __boost_basic_auto_function_macro__ here is its
+ability to force substitution to fail when the body of our function would not
+compile. This functionality succeeds at emitting a single error message at the
+site of the top-level `multi_cast` call as opposed to one nested inside of
+multiple template instantiations and allows such `multi_cast` calls to be used
+to force even higher-level substitutions to fail.
+
+Let's look at an implementation (for the exact source code, refer to
+[@boost:libs/auto_function/example/multi_cast/basic_auto_function_multi_cast.cpp
+example/multi_cast/basic_auto_function_multi_cast.cpp]).
+
+[import ../example/multi_cast/basic_auto_function_multi_cast.cpp]
+[basic_auto_function_multi_cast]
+
+The code above has slightly less redundancy than our earlier example, but its
+advantages come more from its use.
+
+[heading Usage]
+
+With the same usage as we saw from our first solution, GCC 4.5.1 is able to emit
+a much simpler error message.
+
+ main.cpp:49:73: error: no matching function for call to 'multi_cast(left&)'
+
+The same user-mistake now produces exactly one error, pointing to the correct
+line in the programmer's code where the error was made rather than within a
+`multi_cast` template. The only downside is that there is no message explaining
+exactly /why/ the error is there, though in future releases of
+__boost_auto_function__ there will be a way for the developer to provide more
+descriptive messages to the user.
+
+[heading Alternate Implementation with =Boost.Auto_Function=]
+
+Much like with the previous tutorial, at this point in time no known compilers
+are able to support the above implementation. Instead, we must use one that
+appears to be slightly more complicated (for the exact source code, refer to
+[@boost:libs/auto_function/example/multi_cast/auto_function_multi_cast.cpp
+example/multi_cast/auto_function_multi_cast.cpp]).
+
+[import ../example/multi_cast/auto_function_multi_cast.cpp]
+[auto_function_multi_cast]
+
+Usage of this code should be just the same as our previous
+__boost_auto_function__ implementation with the same, simple error message.
+
+[endsect]

Added: sandbox/auto_function/libs/auto_function/example/first/auto_function_first.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/example/first/auto_function_first.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,32 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+//[ auto_function_first
+#include <boost/auto_function/auto_function.hpp>
+#include <boost/range/begin.hpp>
+
+template< class RangeType >
+BOOST_AUTO_FUNCTION
+( ( first( RangeType& range_ ) )
+, ( return *boost::begin( range_ ) )
+)
+//]
+
+#include <boost/array.hpp>
+#include <boost/range/reference.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+boost::array< int, 1 > range_test;
+
+BOOST_STATIC_ASSERT
+( ( boost::is_same< decltype( ::first( range_test ) )
+ , boost::range_reference< boost::array< int, 1 > >::type
+ >::value
+ )
+);

Added: sandbox/auto_function/libs/auto_function/example/first/basic_auto_function_first.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/example/first/basic_auto_function_first.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,32 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+//[ basic_auto_function_first
+#include <boost/auto_function/basic_auto_function.hpp>
+#include <boost/range/begin.hpp>
+
+template< class RangeType >
+BOOST_BASIC_AUTO_FUNCTION( first( RangeType& range_ ) )
+(
+ return *boost::begin( range_ );
+)
+//]
+
+#include <vector>
+#include <boost/range/reference.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+std::vector< int > range_test;
+
+BOOST_STATIC_ASSERT
+( ( boost::is_same< decltype( ::first( range_test ) )
+ , boost::range_reference< std::vector< int > >::type
+ >::value
+ )
+);

Added: sandbox/auto_function/libs/auto_function/example/first/no_auto_function_first.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/example/first/no_auto_function_first.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,20 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+//[ no_auto_function_first
+#include <boost/range/begin.hpp> // For boost::begin
+#include <boost/range/reference.hpp> // For the range_reference metafunction
+
+// Dereference the first element of the range
+template< class RangeType >
+typename boost::range_reference< RangeType >::type
+first( RangeType& range_ )
+{
+ return *boost::begin( range_ );
+}
+//]

Added: sandbox/auto_function/libs/auto_function/example/multi_cast/auto_function_multi_cast.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/example/multi_cast/auto_function_multi_cast.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,61 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+//[ auto_function_multi_cast
+#include <boost/auto_function/auto_function.hpp> // For BOOST_AUTO_FUNCTION
+#include <utility> // For std::forward
+
+// The terminating case that returns the argument itself when no explicit
+// target type is provided
+template< class SourceType >
+BOOST_AUTO_FUNCTION
+( ( multi_cast( SourceType&& source ) )
+, ( return source )
+)
+
+// The primary function template. It works by using a static_cast on the result
+// of another multi_cast call with the final target type removed
+template< class TargetType
+ , class... IntermediateTypes
+ , class SourceType
+ >
+BOOST_AUTO_FUNCTION
+( ( multi_cast( SourceType&& source ) )
+, ( return static_cast< TargetType >
+ ( multi_cast< IntermediateTypes... >
+ ( std::forward< SourceType >( source ) )
+ )
+ )
+)
+//]
+
+// Base types
+struct left {};
+struct right {};
+
+// A derived type that inherits from both "left" and "right"
+struct child : left, right {};
+
+// A type unrelated to the above three types
+struct unrelated_type {};
+
+int main()
+{
+ // Create an instance of the derived type
+ child child_;
+
+ // Refer to the instance through its base type "left"
+ left& left_ = child_;
+
+ // The following line successfully cross-casts from "left_" to a reference to
+ // the object through the type "right"
+ right& right_ = multi_cast< right&, child& >( left_ );
+
+ // Simple error message pointing to the following line
+ right& error_ = multi_cast< right&, unrelated_type&, child& >( left_ );
+}

Added: sandbox/auto_function/libs/auto_function/example/multi_cast/basic_auto_function_multi_cast.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/example/multi_cast/basic_auto_function_multi_cast.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,61 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+//[ basic_auto_function_multi_cast
+// For BOOST_BASIC_AUTO_FUNCTION
+#include <boost/auto_function/basic_auto_function.hpp>
+#include <utility> // For std::forward
+
+// The terminating case that returns the argument itself when no explicit
+// target type is provided
+template< class SourceType >
+BOOST_BASIC_AUTO_FUNCTION( multi_cast( SourceType&& source ) )
+(
+ return source;
+)
+
+// The primary function template. It works by using a static_cast on the result
+// of another multi_cast call with the final target type removed
+template< class TargetType
+ , class... IntermediateTypes
+ , class SourceType
+ >
+BOOST_BASIC_AUTO_FUNCTION( multi_cast( SourceType&& source ) )
+(
+ return static_cast< TargetType >
+ ( multi_cast< IntermediateTypes... >
+ ( std::forward< SourceType >( source ) )
+ );
+)
+//]
+
+// Base types
+struct left {};
+struct right {};
+
+// A derived type that inherits from both "left" and "right"
+struct child : left, right {};
+
+// A type unrelated to the above three types
+struct unrelated_type {};
+
+int main()
+{
+ // Create an instance of the derived type
+ child child_;
+
+ // Refer to the instance through its base type "left"
+ left& left_ = child_;
+
+ // The following line successfully cross-casts from "left_" to a reference to
+ // the object through the type "right"
+ right& right_ = multi_cast< right&, child& >( left_ );
+
+ // Simple error message pointing to the following line
+ right& error_ = multi_cast< right&, unrelated_type&, child& >( left_ );
+}

Added: sandbox/auto_function/libs/auto_function/example/multi_cast/no_auto_function_multi_cast.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/example/multi_cast/no_auto_function_multi_cast.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,69 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+//[ no_auto_function_multi_cast
+#include <utility> // For std::forward
+
+// The terminating case that returns the argument itself when no explicit
+// target type is provided
+template< class SourceType >
+SourceType&& multi_cast( SourceType&& source )
+{
+ return source;
+}
+
+// The primary function template. It works by using a static_cast on the result
+// of another multi_cast call with the final target type removed
+template< class TargetType
+ , class... IntermediateTypes
+ , class SourceType
+ >
+TargetType multi_cast( SourceType&& source )
+{
+ return static_cast< TargetType >
+ ( multi_cast< IntermediateTypes... >
+ ( std::forward< SourceType >( source ) )
+ );
+}
+//`The function templates themselves are fairly simple and the lack of automatic
+//`return type deduction is not a huge problem since the return types are easily
+//`specified based on the template parameters, but there is at least one
+//`unfortunate drawback of this implementation. If a programmer attempts to use
+//`this template with a type or types which would not form a valid `static_cast`
+//`operation, the implementation will blow up in his or her face, with one or
+//`more errors somewhere nested inside of templates that they themselves did not
+//`write. Let's see exactly what types of error messages one might expect from
+//`misuse.
+
+// Base types
+struct left {};
+struct right {};
+
+// A derived type that inherits from both "left" and "right"
+struct child : left, right {};
+
+// A type unrelated to the above three types
+struct unrelated_type {};
+
+int main()
+{
+ // Create an instance of the derived type
+ child child_;
+
+ // Refer to the instance through its base type "left"
+ left& left_ = child_;
+
+ // The following line successfully cross-casts from "left_" to a reference to
+ // the object through the type "right"
+ right& right_ = multi_cast< right&, child& >( left_ );
+
+ // *Kaboom* This line will cause the compiler to generate some very scary
+ // looking messages in the build log.
+ right& error_ = multi_cast< right&, unrelated_type&, child& >( left_ );
+}
+//]

Added: sandbox/auto_function/libs/auto_function/example/square.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/example/square.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,40 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+#include <boost/static_assert.hpp>
+
+//[ square
+//`The following example demonstrates a function template that squares its
+//`argument, an operation whose result type is often different from that of its
+//`operand, particularly when working with types that have units attached.
+#include <boost/auto_function/basic_auto_function.hpp>
+
+template< class T >
+BOOST_BASIC_AUTO_FUNCTION( square( T const& value ) )
+(
+ return value * value;
+)
+//]
+
+#include <boost/type_traits/is_same.hpp>
+
+struct a {};
+struct b {};
+
+b operator*( a, a );
+
+int test_main( int argc, char* argv[] )
+{
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( square( a() ) ), b >::value ) );
+
+ BOOST_REQUIRE( square( 5 ) != 25 );
+
+ return 0;
+}

Added: sandbox/auto_function/libs/auto_function/test/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/Jamfile 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,33 @@
+#===============================================================================
+# 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)
+#===============================================================================
+# bring in rules for testing
+import testing ;
+
+{
+ test-suite auto_function :
+
+ [ run basic_auto_function.cpp : : : : ]
+ [ run auto_function_if.cpp : : : : ]
+ [ run auto_function_not.cpp : : : : ]
+ [ run auto_function_try.cpp : : : : ]
+ [ run auto_function_explicit.cpp : : : : ]
+ [ run auto_function_virtual_explicit.cpp : : : : ]
+ [ run auto_function_auto_if.cpp : : : : ]
+ [ run auto_function_auto_not.cpp : : : : ]
+ [ run auto_function_do.cpp : : : : ]
+ [ run auto_function_return.cpp : : : : ]
+ [ run auto_function_return_ref.cpp : : : : ]
+ [ run auto_function_return_rvalue_ref.cpp : : : : ]
+ [ run auto_function_return_value.cpp : : : : ]
+ [ run auto_function_void.cpp : : : : ]
+ [ run auto_function_do_and_explicit.cpp : : : : ]
+ [ run auto_function_multiple_of_same_category.cpp : : : : ]
+ [ run auto_function_combinations.cpp : : : : ]
+
+ ;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_auto_if.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_auto_if.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,61 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+#include <boost/array.hpp>
+#include <boost/auto_function/auto_function.hpp>
+#include <boost/mpl/lambda.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+struct dummy_type {};
+
+// For SFINAE check
+dummy_type begin_of( ... );
+
+template< class ContainerType >
+BOOST_AUTO_FUNCTION
+( ( begin_of( ContainerType& container_ ) )
+, ( auto if boost::is_same< boost::mpl::_1, typename ContainerType::iterator > )
+, ( return container_.begin() )
+)
+
+int test_main( int argc, char* argv[] )
+{
+ typedef boost::array< int, 1 > array_type;
+ array_type array_ = { { 0 } };
+ array_type const& const_array_ = array_;
+
+ // Check that type deduction is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( array_ ) )
+ , array_type::iterator
+ >::value
+ )
+ );
+
+ // Check that SFINAE is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( 5 ) )
+ , dummy_type
+ >::value
+ )
+ );
+
+ // Check that auto if is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( const_array_ ) )
+ , dummy_type
+ >::value
+ )
+ );
+
+ BOOST_REQUIRE( ::begin_of( array_ ) == array_.begin() );
+
+ return 0;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_auto_not.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_auto_not.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,61 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+#include <boost/array.hpp>
+#include <boost/auto_function/auto_function.hpp>
+#include <boost/mpl/lambda.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+struct dummy_type {};
+
+// For SFINAE check
+dummy_type begin_of( ... );
+
+template< class ContainerType >
+BOOST_AUTO_FUNCTION
+( ( begin_of( ContainerType& container_ ) )
+, ( auto not boost::is_same< boost::mpl::_1,typename ContainerType::iterator > )
+, ( return container_.begin() )
+)
+
+int test_main( int argc, char* argv[] )
+{
+ typedef boost::array< int, 1 > array_type;
+ array_type array_ = { { 0 } };
+ array_type const& const_array_ = array_;
+
+ // Check that type deduction is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( const_array_ ) )
+ , array_type::const_iterator
+ >::value
+ )
+ );
+
+ // Check that SFINAE is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( 5 ) )
+ , dummy_type
+ >::value
+ )
+ );
+
+ // Check that auto not is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( array_ ) )
+ , dummy_type
+ >::value
+ )
+ );
+
+ BOOST_REQUIRE( ::begin_of( const_array_ ) == const_array_.begin() );
+
+ return 0;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_combinations.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_combinations.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+int test_main( int argc, char* argv[] )
+{
+ return 1;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_do.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_do.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,52 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+#include <boost/auto_function/auto_function.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/array.hpp>
+
+struct dummy_type {};
+
+// To check SFINAE
+dummy_type begin_of( ... );
+
+template< class T >
+BOOST_AUTO_FUNCTION
+( ( begin_of( T const& container_ ) )
+, ( do container_.begin(); )
+)
+
+int test_main( int argc, char* argv[] )
+{
+ boost::array< int, 1 > array_ = { 0 };
+
+ // Check that type deduction is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( array_ ) )
+ , boost::array< int, 1 >::const_iterator
+ >::value
+ )
+ );
+
+ // Check that SFINAE is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( 0 ) )
+ , dummy_type
+ >::value
+ )
+ );
+
+ // Verify that it is turning the correct value
+ BOOST_REQUIRE( &array_.front() == &*::begin_of( array_ ) );
+
+ return 0;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_do_and_explicit.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_do_and_explicit.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+int test_main( int argc, char* argv[] )
+{
+ return 1;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_explicit.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_explicit.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+int test_main( int argc, char* argv[] )
+{
+ return 1;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_if.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_if.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,73 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+#include <boost/auto_function/auto_function.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+
+// For SFINAE check
+struct variadic_result {};
+struct auto_function_result {};
+
+variadic_result arithmetic_function( ... );
+variadic_result arithmetic_function_value_condition( ... );
+
+template< class Type >
+BOOST_AUTO_FUNCTION
+( ( arithmetic_function( Type value_ ) )
+, ( if boost::is_arithmetic< Type > )
+, ( return auto_function_result() )
+)
+
+template< class Type >
+BOOST_AUTO_FUNCTION
+( ( arithmetic_function_value_condition( Type value_ ) )
+, ( if boost::is_arithmetic< Type >::value )
+, ( return auto_function_result() )
+)
+
+int test_main( int argc, char* argv[] )
+{
+ void* not_arithmetic_object = 0;
+
+ // Check that type deduction is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( arithmetic_function( 6. ) )
+ , auto_function_result
+ >::value
+ )
+ );
+
+ // Check that type deduction is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( arithmetic_function_value_condition( 6. ) )
+ , auto_function_result
+ >::value
+ )
+ );
+
+ // Check that if is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( arithmetic_function( not_arithmetic_object ) )
+ , variadic_result
+ >::value
+ )
+ );
+
+ // Check that if is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same
+ < decltype( arithmetic_function_value_condition( not_arithmetic_object ) )
+ , variadic_result
+ >::value
+ )
+ );
+
+ return 0;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_multiple_of_same_category.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_multiple_of_same_category.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+int test_main( int argc, char* argv[] )
+{
+ return 1;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_not.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_not.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,73 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+#include <boost/auto_function/auto_function.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+
+// For SFINAE check
+struct variadic_result {};
+struct auto_function_result {};
+
+variadic_result arithmetic_function( ... );
+variadic_result arithmetic_function_value_condition( ... );
+
+template< class Type >
+BOOST_AUTO_FUNCTION
+( ( arithmetic_function( Type value_ ) )
+, ( not boost::is_arithmetic< Type > )
+, ( return auto_function_result() )
+)
+
+template< class Type >
+BOOST_AUTO_FUNCTION
+( ( arithmetic_function_value_condition( Type value_ ) )
+, ( not boost::is_arithmetic< Type >::value )
+, ( return auto_function_result() )
+)
+
+int test_main( int argc, char* argv[] )
+{
+ void* not_arithmetic_object = 0;
+
+ // Check that type deduction is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( arithmetic_function( not_arithmetic_object ) )
+ , auto_function_result
+ >::value
+ )
+ );
+
+ // Check that type deduction is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same
+ < decltype( arithmetic_function_value_condition( not_arithmetic_object ) )
+ , auto_function_result
+ >::value
+ )
+ );
+
+ // Check that if is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( arithmetic_function( 6. ) )
+ , variadic_result
+ >::value
+ )
+ );
+
+ // Check that if is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( arithmetic_function_value_condition( 6. ) )
+ , variadic_result
+ >::value
+ )
+ );
+
+ return 0;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_return.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_return.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,40 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+#include <boost/auto_function/auto_function.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/array.hpp>
+
+template< class T >
+BOOST_AUTO_FUNCTION
+( ( begin_of( T const& container_ ) )
+, ( return container_.begin() )
+)
+
+int test_main( int argc, char* argv[] )
+{
+ boost::array< int, 1 > array_ = { 0 };
+
+ // Check that type deduction is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( array_ ) )
+ , boost::array< int, 1 >::const_iterator
+ >::value
+ )
+ );
+
+ // Verify that it is turning the correct value
+ BOOST_REQUIRE( &array_.front() == &*::begin_of( array_ ) );
+
+ return 0;
+}
+

Added: sandbox/auto_function/libs/auto_function/test/auto_function_return_ref.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_return_ref.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+int test_main( int argc, char* argv[] )
+{
+ return 1;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_return_rvalue_ref.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_return_rvalue_ref.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+int test_main( int argc, char* argv[] )
+{
+ return 1;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_return_value.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_return_value.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+int test_main( int argc, char* argv[] )
+{
+ return 1;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_try.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_try.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+int test_main( int argc, char* argv[] )
+{
+ return 1;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_virtual_explicit.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_virtual_explicit.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,14 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+int test_main( int argc, char* argv[] )
+{
+ return 1;
+}

Added: sandbox/auto_function/libs/auto_function/test/auto_function_void.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/auto_function_void.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,54 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+#include <boost/auto_function/auto_function.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <vector>
+
+struct dummy_type {};
+
+// For SFINAE check
+dummy_type push_back( ... );
+
+template< class ContainerType >
+BOOST_AUTO_FUNCTION
+( ( push_back( ContainerType& container_ ) )
+, ( void container_.push_back( 5 ) )
+)
+
+int test_main( int argc, char* argv[] )
+{
+ std::vector< int > vector_;
+
+ // Check that type deduction is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::push_back( vector_ ) )
+ , void
+ >::value
+ )
+ );
+
+ // Check that SFINAE is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::push_back( 5 ) )
+ , dummy_type
+ >::value
+ )
+ );
+
+ ::push_back( vector_ );
+
+ // Verify that it pushed back correctly
+ BOOST_REQUIRE( vector_.size() == 1 && vector_.back() == 5 );
+
+ return 0;
+}

Added: sandbox/auto_function/libs/auto_function/test/basic_auto_function.cpp
==============================================================================
--- (empty file)
+++ sandbox/auto_function/libs/auto_function/test/basic_auto_function.cpp 2010-11-06 05:35:27 EDT (Sat, 06 Nov 2010)
@@ -0,0 +1,52 @@
+/*==============================================================================
+ Copyright (c) 2010 Matthew 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)
+==============================================================================*/
+
+#include <boost/test/minimal.hpp>
+
+#include <boost/auto_function/basic_auto_function.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/array.hpp>
+
+struct dummy_type {};
+
+// To check SFINAE
+dummy_type begin_of( ... );
+
+template< class T >
+BOOST_BASIC_AUTO_FUNCTION( begin_of( T const& container_ ) )
+(
+ return container_.begin();
+)
+
+int test_main( int argc, char* argv[] )
+{
+ boost::array< int, 1 > array_ = { 0 };
+
+ // Check that type deduction is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( array_ ) )
+ , boost::array< int, 1 >::const_iterator
+ >::value
+ )
+ );
+
+ // Check that SFINAE is working properly
+ BOOST_STATIC_ASSERT
+ ( ( boost::is_same< decltype( ::begin_of( 0 ) )
+ , dummy_type
+ >::value
+ )
+ );
+
+ // Verify that it is turning the correct value
+ BOOST_REQUIRE( &array_.front() == &*::begin_of( array_ ) );
+
+ return 0;
+}


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