From e04f655cc72a11584f0350e94f5d302bc104bc72 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 18:07:19 +0000 Subject: [PATCH 01/15] Full merge from trunk at revision 41356 of entire boost-root tree. [SVN r41369] --- build/Jamfile | 30 - build/preprocess_arity_loops.cpp | 88 -- build/preprocess_cc_names.cpp | 27 - build/preprocess_encoding.cpp | 45 - build/timestamps/arity_loops | 1 - build/timestamps/cc_names | 2 - build/timestamps/encoding | 1 - doc/Jamfile | 22 - doc/function_types.qbk | 1104 ----------------- .../boost_functiontypes/about_tag_types.html | 94 -- .../boost_functiontypes/acknowledgements.html | 85 -- .../boost_functiontypes/introduction.html | 94 -- doc/html/boost_functiontypes/rationale.html | 149 --- doc/html/boost_functiontypes/reference.html | 49 - .../reference/classification.html | 407 ------ .../reference/decomposition.html | 233 ---- .../boost_functiontypes/reference/macros.html | 246 ---- .../reference/synthesis.html | 230 ---- .../reference/tag_types.html | 320 ----- doc/html/boost_functiontypes/use_cases.html | 175 --- doc/html/boostbook.css | 528 -------- doc/html/index.html | 55 - example/Jamfile | 20 - example/detail/param_type.hpp | 71 -- example/fast_mem_fn.hpp | 248 ---- example/fast_mem_fn_example.cpp | 118 -- example/interface.hpp | 361 ------ example/interface_example.cpp | 79 -- example/interpreter.hpp | 188 --- example/interpreter_example.cpp | 56 - example/macro_type_args.hpp | 73 -- example/macro_type_args_example.cpp | 71 -- example/result_of.hpp | 86 -- example/result_of_example.cpp | 59 - index.html | 14 - test/Jamfile | 85 -- test/classification/is_callable_builtin.cpp | 86 -- test/classification/is_cv_function.cpp | 142 --- test/classification/is_cv_mem_func_ptr.cpp | 150 --- test/classification/is_cv_pointer.cpp | 50 - test/classification/is_function.cpp | 87 -- test/classification/is_function_pointer.cpp | 87 -- test/classification/is_function_reference.cpp | 88 -- .../is_member_function_pointer.cpp | 96 -- .../is_member_object_pointer.cpp | 95 -- test/classification/is_member_pointer.cpp | 88 -- .../is_nonmember_callable_builtin.cpp | 87 -- test/classification/is_variadic.cpp | 143 --- test/custom_ccs/member_ccs.cpp | 50 - test/custom_ccs/member_ccs_exact.cpp | 71 -- test/custom_ccs/nonmember_ccs.cpp | 45 - test/custom_ccs/nonmember_ccs_exact.cpp | 62 - test/decomposition/class_type_transform.cpp | 62 - test/decomposition/components.cpp | 59 - test/decomposition/components_seq.cpp | 75 -- test/decomposition/function_arity.cpp | 31 - test/decomposition/function_arity_fail.cpp | 19 - test/decomposition/parameter_types.cpp | 59 - test/decomposition/parameter_types_fail.cpp | 19 - test/decomposition/result_type.cpp | 63 - test/decomposition/result_type_fail.cpp | 19 - test/reconfiguration/cc_preprocessing.cpp | 11 - .../partial_arity_preprocessing.cpp | 11 - test/reconfiguration/preprocessing_mode.cpp | 11 - test/reconfiguration/simple_test.hpp | 51 - test/synthesis/cv_function_synthesis.cpp | 249 ---- test/synthesis/function_pointer.cpp | 24 - test/synthesis/function_reference.cpp | 24 - test/synthesis/function_type.cpp | 23 - test/synthesis/mem_func_ptr_cv1.cpp | 94 -- test/synthesis/mem_func_ptr_cv2.cpp | 94 -- .../synthesis/mem_func_ptr_cv_ptr_to_this.cpp | 37 - test/synthesis/member_function_pointer.cpp | 66 - test/synthesis/member_object_pointer.cpp | 27 - test/synthesis/transformation.cpp | 75 -- .../synthesis/variadic_function_synthesis.cpp | 63 - 76 files changed, 8207 deletions(-) delete mode 100644 build/Jamfile delete mode 100644 build/preprocess_arity_loops.cpp delete mode 100644 build/preprocess_cc_names.cpp delete mode 100644 build/preprocess_encoding.cpp delete mode 100644 build/timestamps/arity_loops delete mode 100644 build/timestamps/cc_names delete mode 100644 build/timestamps/encoding delete mode 100644 doc/Jamfile delete mode 100644 doc/function_types.qbk delete mode 100644 doc/html/boost_functiontypes/about_tag_types.html delete mode 100644 doc/html/boost_functiontypes/acknowledgements.html delete mode 100644 doc/html/boost_functiontypes/introduction.html delete mode 100644 doc/html/boost_functiontypes/rationale.html delete mode 100644 doc/html/boost_functiontypes/reference.html delete mode 100644 doc/html/boost_functiontypes/reference/classification.html delete mode 100644 doc/html/boost_functiontypes/reference/decomposition.html delete mode 100644 doc/html/boost_functiontypes/reference/macros.html delete mode 100644 doc/html/boost_functiontypes/reference/synthesis.html delete mode 100644 doc/html/boost_functiontypes/reference/tag_types.html delete mode 100644 doc/html/boost_functiontypes/use_cases.html delete mode 100644 doc/html/boostbook.css delete mode 100644 doc/html/index.html delete mode 100644 example/Jamfile delete mode 100644 example/detail/param_type.hpp delete mode 100644 example/fast_mem_fn.hpp delete mode 100644 example/fast_mem_fn_example.cpp delete mode 100644 example/interface.hpp delete mode 100644 example/interface_example.cpp delete mode 100644 example/interpreter.hpp delete mode 100644 example/interpreter_example.cpp delete mode 100644 example/macro_type_args.hpp delete mode 100644 example/macro_type_args_example.cpp delete mode 100644 example/result_of.hpp delete mode 100644 example/result_of_example.cpp delete mode 100644 index.html delete mode 100644 test/Jamfile delete mode 100644 test/classification/is_callable_builtin.cpp delete mode 100644 test/classification/is_cv_function.cpp delete mode 100644 test/classification/is_cv_mem_func_ptr.cpp delete mode 100644 test/classification/is_cv_pointer.cpp delete mode 100644 test/classification/is_function.cpp delete mode 100644 test/classification/is_function_pointer.cpp delete mode 100644 test/classification/is_function_reference.cpp delete mode 100644 test/classification/is_member_function_pointer.cpp delete mode 100644 test/classification/is_member_object_pointer.cpp delete mode 100644 test/classification/is_member_pointer.cpp delete mode 100644 test/classification/is_nonmember_callable_builtin.cpp delete mode 100644 test/classification/is_variadic.cpp delete mode 100644 test/custom_ccs/member_ccs.cpp delete mode 100644 test/custom_ccs/member_ccs_exact.cpp delete mode 100644 test/custom_ccs/nonmember_ccs.cpp delete mode 100644 test/custom_ccs/nonmember_ccs_exact.cpp delete mode 100644 test/decomposition/class_type_transform.cpp delete mode 100644 test/decomposition/components.cpp delete mode 100644 test/decomposition/components_seq.cpp delete mode 100644 test/decomposition/function_arity.cpp delete mode 100644 test/decomposition/function_arity_fail.cpp delete mode 100644 test/decomposition/parameter_types.cpp delete mode 100644 test/decomposition/parameter_types_fail.cpp delete mode 100644 test/decomposition/result_type.cpp delete mode 100644 test/decomposition/result_type_fail.cpp delete mode 100644 test/reconfiguration/cc_preprocessing.cpp delete mode 100644 test/reconfiguration/partial_arity_preprocessing.cpp delete mode 100644 test/reconfiguration/preprocessing_mode.cpp delete mode 100644 test/reconfiguration/simple_test.hpp delete mode 100644 test/synthesis/cv_function_synthesis.cpp delete mode 100644 test/synthesis/function_pointer.cpp delete mode 100644 test/synthesis/function_reference.cpp delete mode 100644 test/synthesis/function_type.cpp delete mode 100644 test/synthesis/mem_func_ptr_cv1.cpp delete mode 100644 test/synthesis/mem_func_ptr_cv2.cpp delete mode 100644 test/synthesis/mem_func_ptr_cv_ptr_to_this.cpp delete mode 100644 test/synthesis/member_function_pointer.cpp delete mode 100644 test/synthesis/member_object_pointer.cpp delete mode 100644 test/synthesis/transformation.cpp delete mode 100644 test/synthesis/variadic_function_synthesis.cpp diff --git a/build/Jamfile b/build/Jamfile deleted file mode 100644 index ce5fb17..0000000 --- a/build/Jamfile +++ /dev/null @@ -1,30 +0,0 @@ - -# (C) Copyright Tobias Schwinger -# -# Use modification and distribution are subject to the boost Software License, -# Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). - -# Generates preprocessed files with wave. - -rule wave -{ - Depends $1 : $2 ; -} - -actions wave -{ - $(BOOST_ROOT)/dist/bin/wave -S$(BOOST_ROOT) $(>) -o $(<) -} - -make $(BOOST_ROOT)/libs/function_types/build/timestamps/arity_loops - : preprocess_arity_loops.cpp : wave - ; - -make $(BOOST_ROOT)/libs/function_types/build/timestamps/encoding - : preprocess_encoding.cpp : wave - ; - -make $(BOOST_ROOT)/libs/function_types/build/timestamps/cc_names - : preprocess_cc_names.cpp : wave - ; - diff --git a/build/preprocess_arity_loops.cpp b/build/preprocess_arity_loops.cpp deleted file mode 100644 index a045e9f..0000000 --- a/build/preprocess_arity_loops.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#if !defined(BOOST_FT_PREPROCESSING_MODE) - -# ifndef __WAVE__ -# error "Boost.Wave preprocessor required" -# endif - -# include -# include - -# if BOOST_PP_NIL // enable dependency scanning for dynamically included files -# include -# include -# include -# include -# endif - -# pragma wave option(line: 0, preserve: 2) -timestamp file -# pragma wave option(output: null) - -# define BOOST_FT_PREPROCESSING_MODE - -# define BOOST_FT_HEADER \ - BOOST_PP_SEQ_CAT((arity)(BOOST_FT_MAX_ARITY)(_)(BOOST_FT_mfp)).hpp - #define BOOST_FT_OUT_FILE \ - BOOST_PP_STRINGIZE(../../../BOOST_FT_al_path/BOOST_FT_HEADER) - -# define BOOST_FT_al_path boost/function_types/detail/components_impl -# include __FILE__ -# undef BOOST_FT_al_path - -# define BOOST_FT_al_path boost/function_types/detail/synthesize_impl -# include __FILE__ -# undef BOOST_FT_al_path - -# define BOOST_FT_al_path boost/function_types/detail/classifier_impl -# include __FILE__ -# undef BOOST_FT_al_path - -#elif !defined(BOOST_FT_mfp) - -# define BOOST_FT_mfp 0 -# include __FILE__ -# undef BOOST_FT_mfp - -# define BOOST_FT_mfp 1 -# include __FILE__ -# undef BOOST_FT_mfp - -#elif !defined(BOOST_FT_MAX_ARITY) - -# define BOOST_FT_FROM_ARITY 0 -# define BOOST_FT_MAX_ARITY 10 -# include __FILE__ - -# define BOOST_FT_FROM_ARITY 10 -# define BOOST_FT_MAX_ARITY 20 -# include __FILE__ - -# define BOOST_FT_FROM_ARITY 20 -# define BOOST_FT_MAX_ARITY 30 -# include __FILE__ - -# define BOOST_FT_FROM_ARITY 30 -# define BOOST_FT_MAX_ARITY 40 -# include __FILE__ - -# define BOOST_FT_FROM_ARITY 40 -# define BOOST_FT_MAX_ARITY 50 -# include __FILE__ - -#else - -# pragma message(generating BOOST_FT_OUT_FILE) -# pragma wave option(preserve: 2, output: BOOST_FT_OUT_FILE) -# include -# undef BOOST_FT_MAX_ARITY - -#endif - diff --git a/build/preprocess_cc_names.cpp b/build/preprocess_cc_names.cpp deleted file mode 100644 index 39d77c5..0000000 --- a/build/preprocess_cc_names.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#ifndef __WAVE__ -# error "Boost.Wave preprocessor required" -#endif - -#pragma wave option(line: 0, preserve: 2) -timestamp file -#pragma wave option(output: null) - -#define BOOST_FT_PREPROCESSING_MODE - - -#define BOOST_FT_OUT_FILE \ - "../../../boost/function_types/detail/pp_cc_loop/preprocessed.hpp" -#pragma message(generating BOOST_FT_OUT_FILE) -#pragma wave option(output: BOOST_FT_OUT_FILE, preserve: 2) -#include -#pragma wave option(output: null) -#undef BOOST_FT_OUT_FILE - diff --git a/build/preprocess_encoding.cpp b/build/preprocess_encoding.cpp deleted file mode 100644 index e2e4a5e..0000000 --- a/build/preprocess_encoding.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#ifndef __WAVE__ -# error "Boost.Wave preprocessor required" -#endif - -#pragma wave option(line: 0, preserve: 2) -timestamp file -#pragma wave option(output: null) - -#define BOOST_FT_PREPROCESSING_MODE - - -#define BOOST_FT_OUT_FILE \ - "../../../boost/function_types/detail/pp_tags/preprocessed.hpp" -#pragma message(generating BOOST_FT_OUT_FILE) -#pragma wave option(output: BOOST_FT_OUT_FILE, preserve: 2) -#include -#pragma wave option(output: null) -#undef BOOST_FT_OUT_FILE - -#define BOOST_FT_OUT_FILE \ - "../../../boost/function_types/detail/pp_variate_loop/preprocessed.hpp" -#pragma message(generating BOOST_FT_OUT_FILE) -#pragma wave option(output: BOOST_FT_OUT_FILE, preserve: 2) -#include -#pragma wave option(output: null) -#undef BOOST_FT_OUT_FILE - -#define BOOST_FT_OUT_FILE \ - "../../../boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp" -#pragma message(generating BOOST_FT_OUT_FILE) -#pragma wave option(output: BOOST_FT_OUT_FILE, preserve: 2) -#include -#pragma wave option(output: null) - -#undef BOOST_FT_OUT_FILE - - diff --git a/build/timestamps/arity_loops b/build/timestamps/arity_loops deleted file mode 100644 index f91091c..0000000 --- a/build/timestamps/arity_loops +++ /dev/null @@ -1 +0,0 @@ -timestamp file diff --git a/build/timestamps/cc_names b/build/timestamps/cc_names deleted file mode 100644 index e33ac14..0000000 --- a/build/timestamps/cc_names +++ /dev/null @@ -1,2 +0,0 @@ -timestamp file - diff --git a/build/timestamps/encoding b/build/timestamps/encoding deleted file mode 100644 index f91091c..0000000 --- a/build/timestamps/encoding +++ /dev/null @@ -1 +0,0 @@ -timestamp file diff --git a/doc/Jamfile b/doc/Jamfile deleted file mode 100644 index 5b46953..0000000 --- a/doc/Jamfile +++ /dev/null @@ -1,22 +0,0 @@ - -# (C) Copyright Tobias Schwinger -# -# Use modification and distribution are subject to the boost Software License, -# Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). - -using quickbook ; - -xml function_types : function_types.qbk ; -boostbook standalone - : - function_types - : - boost.root=../../../.. - boost.libraries=../../../libraries.htm - chunk.first.sections=1 - chunk.section.depth=2 - generate.section.toc.level=2 - toc.section.depth=1 - toc.max.depth=1 - ; - diff --git a/doc/function_types.qbk b/doc/function_types.qbk deleted file mode 100644 index 0f989ae..0000000 --- a/doc/function_types.qbk +++ /dev/null @@ -1,1104 +0,0 @@ -[library Boost.FunctionTypes - [quickbook 1.3] - [version 2.5] - [authors [Schwinger, Tobias]] - [copyright 2004-2007 Tobias Schwinger] - [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]) - ] - [purpose Meta-programming support library] - [category template] - [category generic] - [last-revision $Date$] -] - -[def __unspecified__ /unspecified/] - -[def __mpl__ [@../../../mpl/index.html MPL]] -[def __mpl_integral_constant__ __mpl__ - [@../../../mpl/doc/refmanual/integral-constant.html Integral Constant]] -[def __mpl_fwd_seq__ __mpl__ - [@../../../mpl/doc/refmanual/forward-sequence.html Forward Sequence]] -[def __mpl_fb_ext_ra_seq__ __mpl__ - [@../../../mpl/doc/refmanual/front-extensible-sequence.html Front] / [@../../../mpl/doc/refmanual/back-extensible-sequence.html Back ][@../../../mpl/doc/refmanual/extensible-sequence.html Extensible ][@../../../mpl/doc/refmanual/random-access-sequence.html Random Access Sequence]] -[def __mpl_lambda_expression__ __mpl__ - [@../../../mpl/doc/refmanual/lambda-expression.html Lambda Expression]] - -[def __is_function [link boost_functiontypes.reference.classification.is_function is_function]] -[def __is_function_pointer [link boost_functiontypes.reference.classification.is_function_pointer is_function_pointer]] -[def __is_function_reference [link boost_functiontypes.reference.classification.is_function_reference is_function_reference]] -[def __is_member_function_pointer [link boost_functiontypes.reference.classification.is_member_function_pointer is_member_function_pointer]] -[def __is_callable_builtin [link boost_functiontypes.reference.classification.is_callable_builtin is_callable_builtin]] -[def __is_nonmember_callable_builtin [link boost_functiontypes.reference.classification.is_nonmember_callable_builtin is_nonmember_callable_builtin]] - -[def __components [link boost_functiontypes.reference.decomposition.components components]] -[def __parameter_types [link boost_functiontypes.reference.decomposition.parameter_types parameter_types]] -[def __function_arity [link boost_functiontypes.reference.decomposition.function_arity function_arity]] -[def __result_type [link boost_functiontypes.reference.decomposition.result_type result_type]] - -[def __function_type [link boost_functiontypes.reference.synthesis.function_type function_type]] -[def __function_pointer [link boost_functiontypes.reference.synthesis.function_pointer function_pointer]] -[def __function_reference [link boost_functiontypes.reference.synthesis.function_reference function_reference] -[def __member_function_pointer [link boost_functiontypes.reference.synthesis.member_function_pointer member_function_pointer]] - -[def __null_tag [link boost_functiontypes.reference.tag_types.null_tag null_tag]] - -[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] - -[section:introduction Introduction] - -Boost.FunctionTypes provides functionality to classify, decompose and synthesize -function, function pointer, function reference and pointer to member types. - -We collectively refer to these types as /callable builtin/ types. - -In particular, the library can be used to: - -* test whether a type is a specific callable, builtin type, -* extract all component properties from callable, builtin types, and -* create callable, builtin types from specified properties. - -The library is designed to work well with other Boost libraries and uses -well-accepted concepts introduced by Boost and TR1. - -Templates that encapsulate boolean or numeric properties define a static member -constant called [^value]. - - __is_function_pointer< bool(*)(int) >::value // == true - - __function_arity< bool(*)(int) >::value // == 1 - -Templates that encapsulate properties that are single types contain a type -member called [^type]. - - __function_type< mpl::vector >::type // is bool(int) - - __result_type< bool(&)(int) >::type // is bool - -Templates that encapsulate properties that are type lists model an -MPL-compatible type sequence. - - __parameter_types< bool(int) > // models an MPL sequence - -[endsect] - -[section:use_cases Use Cases] - -Generic libraries that accept callable arguments are common in C++. -Accepting a callable argument of builin type often involves a lot of repetitive -code because the accepting function is overloaded for different function -arities. Further, member functions may have [^const]/[^volatile]-qualifiers, -a function may take a variable number of (additional, POD-typed) arguments (such -as [^printf]) and several C++ implementations encode a calling convention with -each function's type to allow calls across language or (sub-)system boundaries. - - template - void accept_function(R(* func)()); - - template - void accept_function(R(& func)()); - - template - void accept_function(R(C::* func)()); - - template - void accept_function(R(C::* func)() const); - - template - void accept_function(R(C::* func)() volatile); - - template - void accept_function(R(C::* func)() const volatile); - - template - void accept_function(R(* func)(...)); - - template - void accept_function(R(& func)(...)); - - template - void accept_function(R(C::* func)(...)); - - template - void accept_function(R(C::* func)(...) const); - - template - void accept_function(R(C::* func)(...) volatile); - - template - void accept_function(R(C::* func)(...) const volatile); - - // ... - - // needs to be repeated for every additional function parameter - // times the number of possible calling conventions - -The "overloading approach" obviously does not scale well: There might be several -functions that accept callable arguments in one library and client code might -end up using several libraries that use this pattern. -On the developer side, library developers spend their time solving the same -problem, working around the same portability issues, and apply similar -optimizations to keep the compilation time down. - -Using Boost.FunctionTypes it is possible to write a single function template -instead: - - template - void accept_function(F f) - { - // ... use Boost.FunctionTypes to analyse F - } - -The combination with a tuples library that provides an invoker component, such -as [@../../../fusion/index.html Boost.Fusion], allows to build flexible callback -facilities that are entirely free of repetitive code as shown by the -[@../../../function_types/example/interpreter.hpp interpreter example]. - -When taking the address of an overloaded function or function template, the -type of the function must be known from the context the expression is used -in. The code below shows three examples for choosing the [^float(float)] -overload of [^std::abs]. - - float (*ptr_absf)(float) = & std::abs; - - - void foo(float(*func)(float)); - - void bar() - { - foo(& std::abs); - } - - - std::transform(b, e, o, static_cast(& std::abs)); - -The library's type synthesis capabilities can be used to automate overload -selection and instantiation of function templates. Given an overloaded function -template - - template - R overloaded(T0); - - template - R overloaded(T0,T1); - - template - R overloaded(T0,T1,T2); - -we can pick any of the three overloads and instantiate the template with -template arguments from a type sequence in a single expression: - - static_cast<__function_pointer::type>(& overloaded) - -This technique can be occasionally more flexible than template argument -deduction from a function call because the exact types from the sequence -are used to specialize the template (including possibly cv-qualified -reference types and the result type). It is applied twice in the -[@../../../function_types/example/interface.hpp interface example]. - -Another interersting property of callable, builtin types is that they can be -valid types for non-type template parameters. This way, a function can be -pinpointed at compile time, allowing the compiler to eliminate the call by -inlining. -The [@../../../function_types/example/fast_mem_fn.hpp fast_mem_fn example] -exploits this characteristic and implements a potentially inlining version of -[@../../../bind/mem_fn.html boost::mem_fn] -limited to member functions that are known at compile time. - -[endsect] - - -[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] -[section:about_tag_types About Tag Types] - -Boost.FunctionTypes uses tag types to encode properties that are not types -per se, such as calling convention or whether a function is variadic or cv- -qualified. - -These tags can be used to determine whether one property of a type has a -particular value. - - is_function::value // == true - is_function::value // == false - -A compound property tag describes a combination of possible values of different -properties. -The type [^components], where [^F] is a callable builtin type, is a compound -property tag that describes [^F]. -The [^tag] class template can be used to combine property tags. - - tag // combination of two properties - -When several values for the same property are specified in [^tag]'s argument -list, only the rightmost one is used; others are ignored. - - tag, default_cc> // overrides F's calling convention property - -When compound property tag is specified to analyse a type, all of its component -properties must match. - - is_member_function_pointer< F, tag >::value - // true for - // F = void(a_class::*)() const - // false for - // F = void(a_class::*)() - // F = void(__fastcall a_class::*)() const - -Default values are selected for properties not specified by the tag in the -context of type synthesis. - - // given S = mpl::vector - - member_function_pointer::type // is int (a_class::*)() const - // note: the cv-qualification is picked based on the class type, - // a nonvariadic signature and the default calling convention - // are used - - member_function_pointer::type // is int (a_class::*)() - // no const qualification, as explicitly specified by the tag type - -[endsect] - - -[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] - -[section:reference Reference] - - -[section:classification Class templates for type classification] - -[section:is_function is_function] - - template - struct is_function; - -[*Header] - - #include - -[variablelist - [[[^T]][Type to analyze]] - [[[^Tag]][Further properties required for a positive result]] - [[[^is_function]][Predicate value as __mpl_integral_constant__]] - [[[^is_function::value]][Constant boolean value]] -] - -Determines whether a given type is a function, possibly with -additional properties as specified by a property tag. - -[endsect] - - -[section:is_function_pointer is_function_pointer] - - template - struct is_function_pointer; - -[*Header] - - #include - -[variablelist - [[[^T]][Type to analyze]] - [[[^Tag]][Further properties required for a positive result]] - [[[^is_function_pointer]][Predicate value __mpl_integral_constant__]] - [[[^is_function_pointer::value]][Constant boolean value]] -] - -Determines whether a given type is a function pointer, possibly with -additional properties as specified by a property tag. - -[endsect] - - -[section:is_function_reference is_function_reference] - - template - struct is_function_reference; - -[*Header] - - #include - -[variablelist - [[[^T]][Type to analyze]] - [[[^Tag]][Further properties required for a positive result]] - [[[^is_function_reference]][Predicate value __mpl_integral_constant__]] - [[[^is_function_reference::value]][Constant boolean value]] -] - -Determines whether a given type is a function reference, possibly with -additional properties as specified by a property tag. - -[endsect] - - -[section:is_member_pointer is_member_pointer] - - template - struct is_member_pointer; - -[*Header] - - #include - -[variablelist - [[[^T]][Type to analyze]] - [[[^Tag]][Further properties required for a positive result]] - [[[^is_member_pointer]][Predicate value __mpl_integral_constant__]] - [[[^is_member_pointer::value]][Constant boolean value]] -] - -Determines whether a given type is a pointer to member (object or function) -type, possibly with additional properties as specified by a property tag. - -[endsect] - - -[section:is_member_object_pointer is_member_object_pointer] - - template - struct is_member_object_pointer; - -[*Header] - - #include - -[variablelist - [[[^T]][Type to analyze]] - [[[^is_member_object_pointer]][Predicate value __mpl_integral_constant__]] - [[[^is_member_object_pointer::value]][Constant boolean value]] -] - -Determines whether a given type is a pointer to member object type. - -[endsect] - - -[section:is_member_function_pointer is_member_function_pointer] - - template - struct is_member_function_pointer; - -[*Header] - - #include - -[variablelist - [[[^T]][Type to analyze]] - [[[^Tag]][Further properties required for a positive result]] - [[[^is_member_function_pointer]][Predicate value __mpl_integral_constant__]] - [[[^is_member_function_pointer::value]][Constant boolean value]] -] - -Determines whether a given type is a member function pointer, possibly with -additional properties as specified by a property tag. - -[endsect] - - -[section:is_callable_builtin is_callable_builtin] - - template - struct is_callable_builtin; - -[*Header] - - #include - -[variablelist - [[[^T]][Type to analyze]] - [[[^Tag]][Further properties required for a positive result]] - [[[^is_callable_builtin]][Predicate value as __mpl_integral_constant__]] - [[[^is_callable_builtin::value]][Constant boolean value]] -] - -Determines whether a given type is a callable builtin, possibly with -additional properties as specified by a property tag. - -[endsect] - - - -[section:is_nonmember_callable_builtin is_nonmember_callable_builtin] - - template - struct is_nonmember_callable_builtin; - -[*Header] - - #include - -[variablelist - [[[^T]][Type to analyze]] - [[[^Tag]][Further properties required for a positive result]] - [[[^is_nonmember_callable_builtin]][Predicate value as __mpl_integral_constant__]] - [[[^is_nonmember_callable_builtin::value]][Constant boolean value]] -] - -Determines whether a given type is a callable builtin that is not a -member function pointer, possibly with -additional properties as specified by a property tag. - -[endsect] - - -[endsect] [/ Class templates for type classification ] - -[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] - -[section:decomposition Class templates for type decomposition] - - -[section:result_type result_type] - - template - struct result_type; - -[*Header] - - #include - -[variablelist - [[[^F]][Type to analyze]] - [[[^result_type::type]][Result type of [^F]]] -] - -Extracts the result type of a callable, builtin type. - -If [^F] is no callable, builtin type, any attempt to access the -[^type] member results in a compile error. - -[endsect] - - -[section:parameter_types parameter_types] - - template > - struct parameter_types; - -[*Header] - - #include - -[variablelist - [[[^F]][Type to analyze]] - [[[^ClassTransform]] - [__mpl_lambda_expression__ to transform the - class type if [^F] is a member function pointer]] - - [[[^parameter_types]] - [__mpl_fb_ext_ra_seq__ of parameter types]] -] - -Extracts the parameter types of a callable, builtin type. - -If [^F] is no callable, builtin type, any attempt to access the -sequence results in a compile error. - -[endsect] - - -[section:function_arity function_arity] - - template - struct function_arity; - -[*Header] - - #include - -[variablelist - [[[^F]][Callable builtin type]] - [[[^function_arity]][Function arity as __mpl_integral_constant__]] - [[[^function_arity::value]][Constant value of the function arity]] -] - -Extracts the function arity, that is the number of parameters. -The hidden [^this] of member function pointers counts, in other words -the arity value is always greater than or equal to one if [^F] is a -member function pointer. - -If [^F] is no callable, builtin type, any attempt to access the -value results in a compile error. - -[endsect] - - -[section:components components] - - template > - struct components; - -[*Header] - - #include - -[variablelist - [[[^T]][Type to analyze]] - [[[^ClassTransform]] - [__mpl_lambda_expression__ to transform the - class type if [^T] is a member function pointer]] - - [[[^components]] - [__mpl_fb_ext_ra_seq__ of all - component types and property tag]] - [[[^components::types]] - [Decorated MPL Sequence, exposed for optimization]] -] - -Extracts all properties of a callable builtin type, that is the result type, -followed by the parameter types (including the type of [^this] for member -function pointers). - -If [^T] is no callable builtin type, the component types are an empty -sequence and the Tag's meaning is equivalent to the [^__null_tag]. - -[endsect] - -[endsect] [/ Class templates for type decomposition] - -[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] - -[section:synthesis Class templates for type synthesis] - - -[section:function_type function_type] - - template - struct function_type; - -[*Header] - - #include - -[variablelist - [[[^Types]][Component types in form of an __mpl_fwd_seq__ or another callable, builtin type]] - [[[^Tag]][Further properties]] - [[[^function_type::type]][Synthesized type]] -] - -Synthesizes a function type from given properties. - -If the template parameters do not describe a valid type, any attempt -to access the [^type] member will result in a compile error. - -[endsect] - - -[section:function_pointer function_pointer] - - template - struct function_pointer; - -[*Header] - - #include - -[variablelist - [[[^Types]][Component types in form of an __mpl_fwd_seq__ or another callable, builtin type]] - [[[^Tag]][Further properties]] - [[[^function_pointer::type]][Synthesized type]] -] - -Synthesizes a function pointer type from given properties. - -If the template parameters do not describe a valid type, any attempt -to access the [^type] member will result in a compile error. - -[endsect] - - -[section:function_reference function_reference] - - template - struct function_reference; - -[*Header] - - #include - -[variablelist - [[[^Types]][Component types in form of an __mpl_fwd_seq__ or another callable, builtin type]] - [[[^Tag]][Further properties]] - [[[^function_reference::type]][Synthesized type]] -] - -Synthesizes a function reference type from given properties. - -If the template parameters do not describe a valid type, any attempt -to access the [^type] member will result in a compile error. - -[endsect] - - -[section:member_function_pointer member_function_pointer] - - template - struct member_function_pointer; - -[*Header] - - #include - -[variablelist - [[[^Types]][Component types in form of an __mpl_fwd_seq__ or another callable, builtin type]] - [[[^Tag]][Further properties]] - [[[^member_function_pointer::type]][Synthesized type]] -] - -Synthesizes a member function pointer type from given properties. - -An optional reference or possibly cv-qualified pointer is removed from -the second type in the sequence to determine the the class type. -The cv-qualification of the resulting type applies to the member -function, unless otherwise explicitly specified by the property tag. - -If the template parameters do not describe a valid type, any attempt -to access the [^type] member will result in a compile error. - -[endsect] - - -[endsect] [/ Class templates for type synthesis ] - -[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] - -[section:tag_types Tag Types] - -[section:variadic variadic] - - typedef __unspecified__ variadic; - -[*Header] - - #include - -States that a function type takes a variable number of arguments through -an ellipsis parameter (such as [^printf]). - -[endsect] - -[section:non_variadic non_variadic] - - typedef __unspecified__ non_variadic; - -[*Header] - - #include - -States that a function type does not have an ellipsis parameter. - -[endsect] - -[section:default_cc default_cc] - - typedef __unspecified__ default_cc; - -[*Header] - - #include - -States that a function type encodes the default calling convention. - -[endsect] - -[section:const_qualified const_qualified] - - typedef __unspecified__ const_qualified; - -[*Header] - - #include - -States that a function type is const qualified. - -[endsect] - -[section:non_const non_const] - - typedef __unspecified__ non_const; - -[*Header] - - #include - -States that a function type is not const qualified. - -[endsect] - -[section:volatile_qualified volatile_qualified] - - typedef __unspecified__ volatile_qualified; - -[*Header] - - #include - -States that a function type is volatile qualified. - -[endsect] - -[section:non_volatile non_volatile] - - typedef __unspecified__ non_volatile; - -[*Header] - - #include - -States that a function type is not volatile qualified. - -[endsect] - -[section:non_cv non_cv] - - typedef __unspecified__ non_cv; - -[*Header] - - #include - -States that a function type is neither const nor volatile qualified. -Equivalent to `__tag<__non_const,__non_volatile>`, but involves -fewer template instantiations when evaluated. - -[endsect] - -[section:const_non_volatile const_non_volatile] - - typedef __unspecified__ const_non_volatile; - -[*Header] - - #include - -States that a function type is const but not volatile qualified. -Equivalent to `__tag<__const_qualified,__non_volatile>`, but involves -fewer template instantiations when evaluated. - -[endsect] - -[section:volatile_non_const volatile_non_const] - - typedef __unspecified__ volatile_non_const; - -[*Header] - - #include - -States that a function type is volatile but not const qualified. -Equivalent to `__tag<__volatile_qualified,__non_const>`, but involves -fewer template instantiations when evaluated. - -[endsect] - -[section:cv_qualfied cv_qualfied] - - typedef __unspecified__ cv_qualified; - -[*Header] - - #include - -States that a function type is both const and volatile qualified. -Equivalent to `__tag<__const_qualified,__volatile_qualified>`, but involves -fewer template instantiations when evaluated. - -[endsect] - -[section:null_tag null_tag] - - typedef __unspecified__ null_tag; - -[*Header] - - #include - -States nothing. - -[endsect] - -[section:tag tag] - - template - struct tag; - -[*Header] - - #include - -[variablelist - [[[^Tag['N]]][Property tag]] - [[[^tag]][Compound property tag]] -] - -Combination of up to four property tags. If the arguments describe different -values for the same property the value of the rightmost argument is used. - -[endsect] - -[endsect] [/ Tag Types] - -[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] - -[section:macros Macros] - -[section:BOOST_FT_MAX_ARITY BOOST_FT_MAX_ARITY] - -Expands to a numeric value that describes the maximum function arity -supported by the library. - -Defaults to 20 if not explicitly defined by the user before inclusion -of the first library header. - -[endsect] - - - -[*The following macros do not need to be defined, unless to configure -the library to work with a compiler and/or calling convention not covered by -the auto-detection mechanism in [^boost/function_types/config/compiler.hpp].] - - -[section:BOOST_FT_CC_NAMES BOOST_FT_CC_NAMES] - -Expands to a [@../../../preprocessor/doc/data/sequences.html sequence] of -ternary [@../../../preprocessor/doc/data/tuples.html tuples] (these data -types are defined in the [@../../../preprocessor/doc/index.html -documentation of the Boost Preprocessor library]). -Each sequence element describes one calling convention specifier. -The first element in each tuple is the macro suffix for -[link boost_functiontypes.reference.macros.BOOST_FT_CC [^BOOST_FT\_CC\_*]], -the second element is the name of the tag that describes the calling -convention and the third is the name of the specifier. -The specifier is allowed to be an empty string, so the third tuple element -is either [@../../../preprocessor/doc/ref/empty.html [^BOOST_PP_EMPTY]] or -[@../../../preprocessor/doc/ref/identity.html [^BOOST_PP_IDENTITY]][^(['name])]. - -Define this macro to extend the set of possible names for custom calling -conventions. The macro expands to nothing by default. - -The following names are predefined by the library and must not occur in the -definition of [^BOOST_FT_CC_NAMES]: - - #define BOOST_FT_BUILTIN_CC_NAMES \ - (( IMPLICIT , implicit_cc , BOOST_PP_EMPTY ))\ - (( CDECL , cdecl_cc , BOOST_PP_IDENTITY(__cdecl ) ))\ - (( STDCALL , stdcall_cc , BOOST_PP_IDENTITY(__stdcall ) ))\ - (( PASCAL , pascal_cc , BOOST_PP_IDENTITY(pascal ) ))\ - (( FASTCALL , fastcall_cc , BOOST_PP_IDENTITY(__fastcall) ))\ - (( CLRCALL , clrcall_cc , BOOST_PP_IDENTITY(__clrcall ) ))\ - (( THISCALL , thiscall_cc , BOOST_PP_IDENTITY(__thiscall) ))\ - (( IMPLICIT_THISCALL , thiscall_cc , BOOST_PP_EMPTY )) - // Don't get confused by the last line, here (thiscall can't be specified - // explicitly prior to MSVC 8). - -[endsect] - -[section:BOOST_FT_CC BOOST_FT\_CC\_*] - -Enables a specific calling convention. * dentoes the macro suffix, as -defined by -[link boost_functiontypes.reference.macros.BOOST_FT_CC_NAMES [^BOOST_FT_CC_NAMES]] -or -[link boost_functiontypes.reference.macros.BOOST_FT_CC_NAMES [^BOOST_FT_BUILTIN_CC_NAMES]]. - -The macro expands to a list of restrictions, separated by the [^|] character. -Possible items are: - -* callable_builtin -* member -* non_member -* variadic -* non_variadic - -If no such macro is defined for a particular calling convention, it is disabled. -Example: - - #define BOOST_FT_CC_STDCALL non_variadic|callable_builtin - // enables stdcall calling convention for all non-variadic, - // callable, builtin types - -[endsect] - -[section:BOOST_FT_COMMON_X86_CCs BOOST_FT_COMMON_X86_CCs] - -Defining this macro causes the following macros to be defined, if not defined -already: - - #define BOOST_FT_CC_CDECL BOOST_FT_COMMON_X86_CCs - #define BOOST_FT_CC_STDCALL non_variadic|BOOST_FT_COMMON_X86_CCs - #define BOOST_FT_CC_FASTCALL non_variadic|BOOST_FT_COMMON_X86_CCs - -[endsect] - -[section:BOOST_FT_SYNTAX BOOST_FT_SYNTAX] - -This macro allows to change the syntax of callable builtin types. -It is useful to handle the compiler specific placement of the calling -convention specifier. - -The default definition is as follows: - - #define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \ - result() lparen() cc_spec() type_mod() name() rparen() - -[endsect] - -[section:BOOST_FT_NULLARY_PARAM BOOST_FT_NULLARY_PARAM] - -Set to [^void] for compilers that insist on a [^void] parameter for -nullary function types, empty by default. - -[endsect] - -[section:BOOST_FT_NO_CV_FUNC_SUPPORT BOOST_FT_NO_CV_FUNC_SUPPORT] - -Disables support for cv-qualified function types. -Cv-qualified function types are illegal by the current standard -version, but there is a pending defect report on that issue. -It defaults to [^1] until the standard changes, setting this macro -to [^0] may not work. - -[endsect] - - - -[*The following macros are useful for testing when changing the source code of -the library.] - - - -[section:BOOST_FT_PREPROCESSING_MODE BOOST_FT_PREPROCESSING_MODE] - -Makes the compiler preprocess as much as possible of the library code -(rather than loading already-preprocessed header files) if defined. - -[endsect] - -[section:BOOST_FT_CC_PREPROCESSING BOOST_FT_CC_PREPROCESSING] - -Makes the compiler preprocess the loop over possible names for custom -calling conventions (rather than loading an already-preprocessed header -file) if defined. - -This macro is defined automatically if -[link boost_functiontypes.reference.macros.BOOST_FT_CC_NAMES [^BOOST_FT_CC_NAMES]] -has been defined. - -[endsect] - -[endsect] - -[endsect] - -[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] - -[section:rationale Rationale] - -[heading Error handling rationale] - -The library does not define the required members of class templates in -case of an error. This technique causes the compiler to stop displaying -diagnostics in client code, at the point where the error actually is, -instead of tracing template instantiations into the implementation of -the library. - -The library's components have limited error conditions, so problematic -input can be spotted easily. - - -[heading Why MPL Sequences?] - -MPL provides algorithms on Sequences, so transformations (such as turning -by-value parameter types into const references for optimized forwarding -or computing a signature to specialize -[@../../../function/index.html [^boost::function]] after applying -[@../../../bind/index.html [^boost::bind]]) can be expressed more -easily. The MPL Sequence concept is compatible with several other Boost -libraries (most importantly [@../../../fusion/index.html Fusion]), -so another reason is interoperability. - - -[heading Pointer to member object types] - -Despite their syntax, pointer to member object types can be seen as -dereferencing functionals. - - -[heading The ClassTransform template parameter] - -[^This]-pointer, [^this]-reference or just the object (or maybe even a -smart pointer to the object) plus adjustments of cv-qualification - all -these cases have their place, somewhere and there is no single best answer. - -Special treatment of the class type within the sequence can significantly -complicate client code. A custom [^ClassTransform] argument allows the -client to adjust the class type before the sequence is formed and then -treat all parameters uniformly. - - -[heading Why tag types?] - -Let's consider the alternatives. - -The first one is just using more templates so every property has to be -asked for explicitly. This approach results in more complicated client -code if more than one propery has to be checked and in a exponentially -larger library interface. - -The second alternative is having the client pass in bit patterns via -non-type template parameters. The logic has to be performed by the -client and there are much more error conditions. Further, class templates -with non-type template parameters do not work within MPL lambda -expressions and can cause problems with older compilers. - -[heading Is it safe to have the synthesis templates take a callable -builtin type or an MPL sequence as the first template argument?] - -Yes, but it isn't immediately obvious as the set of possible MPL sequences -isn't inherently disjoint from the set of callable builtin types. - -However, any attempt to make a builtin type work as an MPL sequence is -a bad idea, because builtin types are accessible before the headers that -make the type a sequence have been included, which can easily violate the -ODR. - -[heading Why does the hidden [^this] parameter count for the -function arity of member functions?] - -It was found preferable that the following condition holds: - - mpl::size< __parameter_types >::value == __function_arity::value - -[heading Why ignore top-level cv-qualifiers on pointers?] - -A cv-qualified pointer is still a pointer. It usually doesn't matter and -even if it does, it's a job for -[@../../../type_traits/index.html Boost.TypeTraits]. - - -[endsect] - -[section:acknowledgements Acknowledgements] - -Thanks go to the following people for supporting the development of this -library in one or the other way: - -* David Abrahams -* Tom Brinkman -* Aleksey Gurtovoy -* Jody Hagins -* Hartmut Kaiser -* Andy Little -* John Maddock -* Paul Mensonides -* Alexander Nasonov -* Richard Smith -* Rob Stewart -* Jonathan Turkanis -* Pavel Vozenilek -* Steven Watanabe - -[endsect] - diff --git a/doc/html/boost_functiontypes/about_tag_types.html b/doc/html/boost_functiontypes/about_tag_types.html deleted file mode 100644 index 217b2ab..0000000 --- a/doc/html/boost_functiontypes/about_tag_types.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - About Tag Types - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
-
- -

- Boost.FunctionTypes uses tag types to encode properties that are not types - per se, such as calling convention or whether a function is variadic or cv- - qualified. -

-

- These tags can be used to determine whether one property of a type has a particular - value. -

-
-is_function<int(...), variadic>::value // == true
-is_function<int()   , variadic>::value // == false
-
-

- A compound property tag describes a combination of possible values of different - properties. The type components<F>, where F - is a callable builtin type, is a compound property tag that describes F. - The tag class template can be used to combine property tags. -

-
-tag<non_const,default_cc> // combination of two properties
-
-

- When several values for the same property are specified in tag's - argument list, only the rightmost one is used; others are ignored. -

-
-tag<components<F>, default_cc> // overrides F's calling convention property
-
-

- When compound property tag is specified to analyse a type, all of its component - properties must match. -

-
-is_member_function_pointer< F, tag<const_qualified,default_cc> >::value
-// true for 
-//   F = void(a_class::*)() const
-// false for
-//   F = void(a_class::*)()
-//   F = void(__fastcall a_class::*)() const
-
-

- Default values are selected for properties not specified by the tag in the - context of type synthesis. -

-
-// given S = mpl::vector<int,a_class const &>
-
-member_function_pointer<S>::type // is int (a_class::*)() const
-// note: the cv-qualification is picked based on the class type,
-// a nonvariadic signature and the default calling convention 
-// are used
-
-member_function_pointer<S,non_const>::type // is int (a_class::*)()
-// no const qualification, as explicitly specified by the tag type
-
-
- - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHomeNext -
- - diff --git a/doc/html/boost_functiontypes/acknowledgements.html b/doc/html/boost_functiontypes/acknowledgements.html deleted file mode 100644 index e8c7c26..0000000 --- a/doc/html/boost_functiontypes/acknowledgements.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - Acknowledgements - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHome -
-
- -

- Thanks go to the following people for supporting the development of this library - in one or the other way: -

-
    -
  • - David Abrahams -
  • -
  • - Tom Brinkman -
  • -
  • - Aleksey Gurtovoy -
  • -
  • - Jody Hagins -
  • -
  • - Hartmut Kaiser -
  • -
  • - Andy Little -
  • -
  • - John Maddock -
  • -
  • - Paul Mensonides -
  • -
  • - Alexander Nasonov -
  • -
  • - Richard Smith -
  • -
  • - Rob Stewart -
  • -
  • - Jonathan Turkanis -
  • -
  • - Pavel Vozenilek -
  • -
  • - Steven Watanabe -
  • -
-
- - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHome -
- - diff --git a/doc/html/boost_functiontypes/introduction.html b/doc/html/boost_functiontypes/introduction.html deleted file mode 100644 index 58151d4..0000000 --- a/doc/html/boost_functiontypes/introduction.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - Introduction - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
-
- -

- Boost.FunctionTypes provides functionality to classify, decompose and synthesize - function, function pointer, function reference and pointer to member types. -

-

- We collectively refer to these types as callable builtin - types. -

-

- In particular, the library can be used to: -

-
    -
  • - test whether a type is a specific callable, builtin type, -
  • -
  • - extract all component properties from callable, builtin types, and -
  • -
  • - create callable, builtin types from specified properties. -
  • -
-

- The library is designed to work well with other Boost libraries and uses well-accepted - concepts introduced by Boost and TR1. -

-

- Templates that encapsulate boolean or numeric properties define a static member - constant called value. -

-
-is_function_pointer< bool(*)(int) >::value // == true 
-
-function_arity< bool(*)(int) >::value // == 1
-
-

- Templates that encapsulate properties that are single types contain a type - member called type. -

-
-function_type< mpl::vector<bool,int> >::type // is bool(int)
-
-result_type< bool(&)(int) >::type // is bool
-
-

- Templates that encapsulate properties that are type lists model an MPL-compatible - type sequence. -

-
-parameter_types< bool(int) > // models an MPL sequence
-
-
- - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHomeNext -
- - diff --git a/doc/html/boost_functiontypes/rationale.html b/doc/html/boost_functiontypes/rationale.html deleted file mode 100644 index 1b71df4..0000000 --- a/doc/html/boost_functiontypes/rationale.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - Rationale - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
-
- -

- - Error - handling rationale -

-

- The library does not define the required members of class templates in case - of an error. This technique causes the compiler to stop displaying diagnostics - in client code, at the point where the error actually is, instead of tracing - template instantiations into the implementation of the library. -

-

- The library's components have limited error conditions, so problematic input - can be spotted easily. -

-

- - Why MPL Sequences? -

-

- MPL provides algorithms on Sequences, so transformations (such as turning by-value - parameter types into const references for optimized forwarding or computing - a signature to specialize boost::function - after applying boost::bind) - can be expressed more easily. The MPL Sequence concept is compatible with several - other Boost libraries (most importantly Fusion), - so another reason is interoperability. -

-

- - Pointer - to member object types -

-

- Despite their syntax, pointer to member object types can be seen as dereferencing - functionals. -

-

- - The - ClassTransform template parameter -

-

- This-pointer, this-reference or just - the object (or maybe even a smart pointer to the object) plus adjustments of - cv-qualification - all these cases have their place, somewhere and there is - no single best answer. -

-

- Special treatment of the class type within the sequence can significantly complicate - client code. A custom ClassTransform argument allows the - client to adjust the class type before the sequence is formed and then treat - all parameters uniformly. -

-

- - Why tag types? -

-

- Let's consider the alternatives. -

-

- The first one is just using more templates so every property has to be asked - for explicitly. This approach results in more complicated client code if more - than one propery has to be checked and in a exponentially larger library interface. -

-

- The second alternative is having the client pass in bit patterns via non-type - template parameters. The logic has to be performed by the client and there - are much more error conditions. Further, class templates with non-type template - parameters do not work within MPL lambda expressions and can cause problems - with older compilers. -

-

- - Is - it safe to have the synthesis templates take a callable builtin type or an - MPL sequence as the first template argument? -

-

- Yes, but it isn't immediately obvious as the set of possible MPL sequences - isn't inherently disjoint from the set of callable builtin types. -

-

- However, any attempt to make a builtin type work as an MPL sequence is a bad - idea, because builtin types are accessible before the headers that make the - type a sequence have been included, which can easily violate the ODR. -

-

- - Why - does the hidden this parameter count for the function arity - of member functions? -

-

- It was found preferable that the following condition holds: -

-
-mpl::size< parameter_types<T> >::value == function_arity<T>::value
-
-

- - Why - ignore top-level cv-qualifiers on pointers? -

-

- A cv-qualified pointer is still a pointer. It usually doesn't matter and even - if it does, it's a job for Boost.TypeTraits. -

-
- - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHomeNext -
- - diff --git a/doc/html/boost_functiontypes/reference.html b/doc/html/boost_functiontypes/reference.html deleted file mode 100644 index f54c521..0000000 --- a/doc/html/boost_functiontypes/reference.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - Reference - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
- - - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHomeNext -
- - diff --git a/doc/html/boost_functiontypes/reference/classification.html b/doc/html/boost_functiontypes/reference/classification.html deleted file mode 100644 index 7ef1d9e..0000000 --- a/doc/html/boost_functiontypes/reference/classification.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - Class - templates for type classification - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
-
- - -
- -
-template<typename T, typename Tag = null_tag>
-struct is_function;
-
-

- Header -

-
-#include <boost/function_types/is_function.hpp>
-
-
-

-
-
T
-

- Type to analyze -

-
Tag
-

- Further properties required for a positive result -

-
is_function<T,Tag>
-

- Predicate value as MPL - - Integral - Constant -

-
is_function<T,Tag>::value
-

- Constant boolean value -

-
-
-

- Determines whether a given type is a function, possibly with additional - properties as specified by a property tag. -

-
-
- -
-template<typename T, typename Tag = null_tag>
-struct is_function_pointer;
-
-

- Header -

-
-#include <boost/function_types/is_function_pointer.hpp>
-
-
-

-
-
T
-

- Type to analyze -

-
Tag
-

- Further properties required for a positive result -

-
is_function_pointer<T,Tag>
-

- Predicate value MPL - - Integral - Constant -

-
is_function_pointer<T,Tag>::value
-

- Constant boolean value -

-
-
-

- Determines whether a given type is a function pointer, possibly with additional - properties as specified by a property tag. -

-
-
- -
-template<typename T, typename Tag = null_tag>
-struct is_function_reference;
-
-

- Header -

-
-#include <boost/function_types/is_function_reference.hpp>
-
-
-

-
-
T
-

- Type to analyze -

-
Tag
-

- Further properties required for a positive result -

-
is_function_reference<T,Tag>
-

- Predicate value MPL - - Integral - Constant -

-
is_function_reference<T,Tag>::value
-

- Constant boolean value -

-
-
-

- Determines whether a given type is a function reference, possibly with - additional properties as specified by a property tag. -

-
-
- -
-template<typename T, typename Tag = null_tag>
-struct is_member_pointer;
-
-

- Header -

-
-#include <boost/function_types/is_member_pointer.hpp>
-
-
-

-
-
T
-

- Type to analyze -

-
Tag
-

- Further properties required for a positive result -

-
is_member_pointer<T,Tag>
-

- Predicate value MPL - - Integral - Constant -

-
is_member_pointer<T,Tag>::value
-

- Constant boolean value -

-
-
-

- Determines whether a given type is a pointer to member (object or function) - type, possibly with additional properties as specified by a property tag. -

-
-
- -
-template<typename T>
-struct is_member_object_pointer;
-
-

- Header -

-
-#include <boost/function_types/is_member_object_pointer.hpp>
-
-
-

-
-
T
-

- Type to analyze -

-
is_member_object_pointer<T>
-

- Predicate value MPL - - Integral - Constant -

-
is_member_object_pointer<T>::value
-

- Constant boolean value -

-
-
-

- Determines whether a given type is a pointer to member object type. -

-
-
- -
-template<typename T, typename Tag = null_tag>
-struct is_member_function_pointer;
-
-

- Header -

-
-#include <boost/function_types/is_member_function_pointer.hpp>
-
-
-

-
-
T
-

- Type to analyze -

-
Tag
-

- Further properties required for a positive result -

-
is_member_function_pointer<T,Tag>
-

- Predicate value MPL - - Integral - Constant -

-
is_member_function_pointer<T,Tag>::value
-

- Constant boolean value -

-
-
-

- Determines whether a given type is a member function pointer, possibly - with additional properties as specified by a property tag. -

-
-
- -
-template<typename T, typename Tag = null_tag>
-struct is_callable_builtin;
-
-

- Header -

-
-#include <boost/function_types/is_callable_builtin.hpp>
-
-
-

-
-
T
-

- Type to analyze -

-
Tag
-

- Further properties required for a positive result -

-
is_callable_builtin<T,Tag>
-

- Predicate value as MPL - - Integral - Constant -

-
is_callable_builtin<T,Tag>::value
-

- Constant boolean value -

-
-
-

- Determines whether a given type is a callable builtin, possibly with additional - properties as specified by a property tag. -

-
-
- -
-template<typename T, typename Tag = null_tag>
-struct is_nonmember_callable_builtin;
-
-

- Header -

-
-#include <boost/function_types/is_nonmember_callable_builtin.hpp>
-
-
-

-
-
T
-

- Type to analyze -

-
Tag
-

- Further properties required for a positive result -

-
is_nonmember_callable_builtin<T,Tag>
-

- Predicate value as MPL - - Integral - Constant -

-
is_nonmember_callable_builtin<T,Tag>::value
-

- Constant boolean value -

-
-
-

- Determines whether a given type is a callable builtin that is not a member - function pointer, possibly with additional properties as specified by a - property tag. -

-
-
- - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHomeNext -
- - diff --git a/doc/html/boost_functiontypes/reference/decomposition.html b/doc/html/boost_functiontypes/reference/decomposition.html deleted file mode 100644 index 91ebf50..0000000 --- a/doc/html/boost_functiontypes/reference/decomposition.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - Class templates - for type decomposition - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
-
- - -
- -
-template<typename F>
-struct result_type;
-
-

- Header -

-
-#include <boost/function_types/result_type.hpp>
-
-
-

-
-
F
-

- Type to analyze -

-
result_type<F>::type
-

- Result type of F -

-
-
-

- Extracts the result type of a callable, builtin type. -

-

- If F is no callable, builtin type, any attempt to access - the type member results in a compile error. -

-
-
- -
-template<typename F, class ClassTransform = add_reference<_> >
-struct parameter_types;
-
-

- Header -

-
-#include <boost/function_types/parameter_types.hpp>
-
-
-

-
-
F
-

- Type to analyze -

-
ClassTransform
-

- MPL - Lambda - Expression to transform the class type if F - is a member function pointer -

-
parameter_types<F,ClassTransform>
-

- MPL - Front - / Back - Extensible - Random - Access Sequence of parameter types -

-
-
-

- Extracts the parameter types of a callable, builtin type. -

-

- If F is no callable, builtin type, any attempt to access - the sequence results in a compile error. -

-
-
- -
-template<typename F>
-struct function_arity;
-
-

- Header -

-
-#include <boost/function_types/function_arity.hpp>
-
-
-

-
-
F
-

- Callable builtin type -

-
function_arity<F>
-

- Function arity as MPL - - Integral - Constant -

-
function_arity<F>::value
-

- Constant value of the function arity -

-
-
-

- Extracts the function arity, that is the number of parameters. The hidden - this of member function pointers counts, in other words - the arity value is always greater than or equal to one if F - is a member function pointer. -

-

- If F is no callable, builtin type, any attempt to access - the value results in a compile error. -

-
-
- -
-template<typename T, class ClassTransform = add_reference<_> >
-struct components;
-
-

- Header -

-
-#include <boost/function_types/components.hpp>
-
-
-

-
-
T
-

- Type to analyze -

-
ClassTransform
-

- MPL - Lambda - Expression to transform the class type if T - is a member function pointer -

-
components<T,ClassTransform>
-

- MPL - Front - / Back - Extensible - Random - Access Sequence of all component types and property tag -

-
components<T,ClassTransform>::types
-

- Decorated MPL Sequence, exposed for optimization -

-
-
-

- Extracts all properties of a callable builtin type, that is the result - type, followed by the parameter types (including the type of this - for member function pointers). -

-

- If T is no callable builtin type, the component types - are an empty sequence and the Tag's meaning is equivalent to the null_tag. -

-
-
- - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHomeNext -
- - diff --git a/doc/html/boost_functiontypes/reference/macros.html b/doc/html/boost_functiontypes/reference/macros.html deleted file mode 100644 index 24c18db..0000000 --- a/doc/html/boost_functiontypes/reference/macros.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - Macros - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
-
- - -
- -

- Expands to a numeric value that describes the maximum function arity supported - by the library. -

-

- Defaults to 20 if not explicitly defined by the user before inclusion of - the first library header. -

-
-

- The following macros do not need to be defined, unless - to configure the library to work with a compiler and/or calling convention - not covered by the auto-detection mechanism in boost/function_types/config/compiler.hpp. -

-
- -

- Expands to a sequence - of ternary tuples - (these data types are defined in the documentation - of the Boost Preprocessor library). Each sequence element describes - one calling convention specifier. The first element in each tuple is the - macro suffix for BOOST_FT_CC_*, - the second element is the name of the tag that describes the calling convention - and the third is the name of the specifier. The specifier is allowed to - be an empty string, so the third tuple element is either BOOST_PP_EMPTY - or BOOST_PP_IDENTITY(name). -

-

- Define this macro to extend the set of possible names for custom calling - conventions. The macro expands to nothing by default. -

-

- The following names are predefined by the library and must not occur in - the definition of BOOST_FT_CC_NAMES: -

-
-#define BOOST_FT_BUILTIN_CC_NAMES \
-  (( IMPLICIT           , implicit_cc , BOOST_PP_EMPTY                ))\
-  (( CDECL              , cdecl_cc    , BOOST_PP_IDENTITY(__cdecl   ) ))\
-  (( STDCALL            , stdcall_cc  , BOOST_PP_IDENTITY(__stdcall ) ))\
-  (( PASCAL             , pascal_cc   , BOOST_PP_IDENTITY(pascal    ) ))\
-  (( FASTCALL           , fastcall_cc , BOOST_PP_IDENTITY(__fastcall) ))\
-  (( CLRCALL            , clrcall_cc  , BOOST_PP_IDENTITY(__clrcall ) ))\
-  (( THISCALL           , thiscall_cc , BOOST_PP_IDENTITY(__thiscall) ))\
-  (( IMPLICIT_THISCALL  , thiscall_cc , BOOST_PP_EMPTY                )) 
-// Don't get confused by the last line, here (thiscall can't be specified
-// explicitly prior to MSVC 8).
-
-
-
- -

- Enables a specific calling convention. * dentoes the macro suffix, as defined - by BOOST_FT_CC_NAMES - or BOOST_FT_BUILTIN_CC_NAMES. -

-

- The macro expands to a list of restrictions, separated by the | - character. Possible items are: -

-
    -
  • - callable_builtin -
  • -
  • - member -
  • -
  • - non_member -
  • -
  • - variadic -
  • -
  • - non_variadic -
  • -
-

- If no such macro is defined for a particular calling convention, it is - disabled. Example: -

-
-#define BOOST_FT_CC_STDCALL non_variadic|callable_builtin
-// enables stdcall calling convention for all non-variadic, 
-// callable, builtin types
-
-
-
- -

- Defining this macro causes the following macros to be defined, if not defined - already: -

-
-#define BOOST_FT_CC_CDECL BOOST_FT_COMMON_X86_CCs
-#define BOOST_FT_CC_STDCALL non_variadic|BOOST_FT_COMMON_X86_CCs
-#define BOOST_FT_CC_FASTCALL non_variadic|BOOST_FT_COMMON_X86_CCs
-
-
-
- -

- This macro allows to change the syntax of callable builtin types. It is - useful to handle the compiler specific placement of the calling convention - specifier. -

-

- The default definition is as follows: -

-
-#define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \
-          result() lparen() cc_spec() type_mod() name() rparen()
-
-
-
- -

- Set to void for compilers that insist on a void - parameter for nullary function types, empty by default. -

-
-
- -

- Disables support for cv-qualified function types. Cv-qualified function - types are illegal by the current standard version, but there is a pending - defect report on that issue. It defaults to 1 until - the standard changes, setting this macro to 0 may not - work. -

-
-

- The following macros are useful for testing when changing - the source code of the library. -

-
- -

- Makes the compiler preprocess as much as possible of the library code (rather - than loading already-preprocessed header files) if defined. -

-
-
- -

- Makes the compiler preprocess the loop over possible names for custom calling - conventions (rather than loading an already-preprocessed header file) if - defined. -

-

- This macro is defined automatically if BOOST_FT_CC_NAMES - has been defined. -

-
-
- - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHomeNext -
- - diff --git a/doc/html/boost_functiontypes/reference/synthesis.html b/doc/html/boost_functiontypes/reference/synthesis.html deleted file mode 100644 index 367db36..0000000 --- a/doc/html/boost_functiontypes/reference/synthesis.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - Class templates - for type synthesis - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
-
- - -
- -
-template<typename Types, typename Tag = null_tag> 
-struct function_type;
-
-

- Header -

-
-#include <boost/function_types/function_type.hpp>
-
-
-

-
-
Types
-

- Component types in form of an MPL - - Forward - Sequence or another callable, builtin type -

-
Tag
-

- Further properties -

-
function_type<Types,Tag>::type
-

- Synthesized type -

-
-
-

- Synthesizes a function type from given properties. -

-

- If the template parameters do not describe a valid type, any attempt to - access the type member will result in a compile error. -

-
-
- -
-template<typename Types, typename Tag = null_tag> 
-struct function_pointer;
-
-

- Header -

-
-#include <boost/function_types/function_pointer.hpp>
-
-
-

-
-
Types
-

- Component types in form of an MPL - - Forward - Sequence or another callable, builtin type -

-
Tag
-

- Further properties -

-
function_pointer<Types,Tag>::type
-

- Synthesized type -

-
-
-

- Synthesizes a function pointer type from given properties. -

-

- If the template parameters do not describe a valid type, any attempt to - access the type member will result in a compile error. -

-
-
- -
-template<typename Types, typename Tag = null_tag> 
-struct function_reference;
-
-

- Header -

-
-#include <boost/function_types/function_reference.hpp>
-
-
-

-
-
Types
-

- Component types in form of an MPL - - Forward - Sequence or another callable, builtin type -

-
Tag
-

- Further properties -

-
function_reference<Types,Tag>::type
-

- Synthesized type -

-
-
-

- Synthesizes a function reference type from given properties. -

-

- If the template parameters do not describe a valid type, any attempt to - access the type member will result in a compile error. -

-
-
- -
-template<typename Types, typename Tag = null_tag> 
-struct member_function_pointer;
-
-

- Header -

-
-#include <boost/function_types/member_function_pointer.hpp>
-
-
-

-
-
Types
-

- Component types in form of an MPL - - Forward - Sequence or another callable, builtin type -

-
Tag
-

- Further properties -

-
member_function_pointer<Types,Tag>::type
-

- Synthesized type -

-
-
-

- Synthesizes a member function pointer type from given properties. -

-

- An optional reference or possibly cv-qualified pointer is removed from - the second type in the sequence to determine the the class type. The cv-qualification - of the resulting type applies to the member function, unless otherwise - explicitly specified by the property tag. -

-

- If the template parameters do not describe a valid type, any attempt to - access the type member will result in a compile error. -

-
-
- - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHomeNext -
- - diff --git a/doc/html/boost_functiontypes/reference/tag_types.html b/doc/html/boost_functiontypes/reference/tag_types.html deleted file mode 100644 index eb40aac..0000000 --- a/doc/html/boost_functiontypes/reference/tag_types.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - Tag Types - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
-
- - -
- -
-typedef unspecified variadic;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type takes a variable number of arguments through - an ellipsis parameter (such as printf). -

-
-
- -
-typedef unspecified non_variadic;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type does not have an ellipsis parameter. -

-
-
- -
-typedef unspecified default_cc;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type encodes the default calling convention. -

-
-
- -
-typedef unspecified const_qualified;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type is const qualified. -

-
-
- -
-typedef unspecified non_const;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type is not const qualified. -

-
-
- -
-typedef unspecified volatile_qualified;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type is volatile qualified. -

-
-
- -
-typedef unspecified non_volatile;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type is not volatile qualified. -

-
-
- -
-typedef unspecified non_cv;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type is neither const nor volatile qualified. Equivalent - to __tag<__non_const,__non_volatile>, - but involves fewer template instantiations when evaluated. -

-
-
- -
-typedef unspecified const_non_volatile;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type is const but not volatile qualified. Equivalent - to __tag<__const_qualified,__non_volatile>, - but involves fewer template instantiations when evaluated. -

-
-
- -
-typedef unspecified volatile_non_const;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type is volatile but not const qualified. Equivalent - to __tag<__volatile_qualified,__non_const>, - but involves fewer template instantiations when evaluated. -

-
-
- -
-typedef unspecified cv_qualified;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States that a function type is both const and volatile qualified. Equivalent - to __tag<__const_qualified,__volatile_qualified>, - but involves fewer template instantiations when evaluated. -

-
-
- -
-typedef unspecified null_tag;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-

- States nothing. -

-
-
- -
-template<class Tag1, class Tag2, 
-    class Tag3 = null_tag, class Tag4 = null_tag>
-struct tag;
-
-

- Header -

-
-#include <boost/function_types/property_tags.hpp>
-
-
-

-
-
TagN
-

- Property tag -

-
tag<Tag1,Tag2...>
-

- Compound property tag -

-
-
-

- Combination of up to four property tags. If the arguments describe different - values for the same property the value of the rightmost argument is used. -

-
-
- - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHomeNext -
- - diff --git a/doc/html/boost_functiontypes/use_cases.html b/doc/html/boost_functiontypes/use_cases.html deleted file mode 100644 index ab9e332..0000000 --- a/doc/html/boost_functiontypes/use_cases.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - Use Cases - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
-
- -

- Generic libraries that accept callable arguments are common in C++. Accepting - a callable argument of builin type often involves a lot of repetitive code - because the accepting function is overloaded for different function arities. - Further, member functions may have const/volatile-qualifiers, - a function may take a variable number of (additional, POD-typed) arguments - (such as printf) and several C++ implementations encode - a calling convention with each function's type to allow calls across language - or (sub-)system boundaries. -

-
-template<typename R>
-void accept_function(R(* func)());
-
-template<typename R>
-void accept_function(R(& func)());
-
-template<typename R, typename C>
-void accept_function(R(C::* func)());
-
-template<typename R, typename C>
-void accept_function(R(C::* func)() const);
-
-template<typename R, typename C>
-void accept_function(R(C::* func)() volatile);
-
-template<typename R, typename C>
-void accept_function(R(C::* func)() const volatile);
-
-template<typename R>
-void accept_function(R(* func)(...));
-
-template<typename R>
-void accept_function(R(& func)(...));
-
-template<typename R, typename C>
-void accept_function(R(C::* func)(...));
-
-template<typename R, typename C>
-void accept_function(R(C::* func)(...) const);
-
-template<typename R, typename C>
-void accept_function(R(C::* func)(...) volatile);
-
-template<typename R, typename C>
-void accept_function(R(C::* func)(...) const volatile);
-
-// ...
-
-// needs to be repeated for every additional function parameter
-// times the number of possible calling conventions
-
-

- The "overloading approach" obviously does not scale well: There might - be several functions that accept callable arguments in one library and client - code might end up using several libraries that use this pattern. On the developer - side, library developers spend their time solving the same problem, working - around the same portability issues, and apply similar optimizations to keep - the compilation time down. -

-

- Using Boost.FunctionTypes it is possible to write a single function template - instead: -

-
-template<typename F>
-void accept_function(F f)
-{
-  // ... use Boost.FunctionTypes to analyse F
-}
-
-

- The combination with a tuples library that provides an invoker component, such - as Boost.Fusion, allows to - build flexible callback facilities that are entirely free of repetitive code - as shown by the interpreter - example. -

-

- When taking the address of an overloaded function or function template, the - type of the function must be known from the context the expression is used - in. The code below shows three examples for choosing the float(float) - overload of std::abs. -

-
-float (*ptr_absf)(float) = & std::abs;
-
-
-void foo(float(*func)(float));
-
-void bar() 
-{ 
-  foo(& std::abs); 
-}
-
-
-std::transform(b, e, o, static_cast<float(*)(float)>(& std::abs));
-
-

- The library's type synthesis capabilities can be used to automate overload - selection and instantiation of function templates. Given an overloaded function - template -

-
-template<typename R, typename T0>
-R overloaded(T0);
-
-template<typename R, typename T0, typename T1>
-R overloaded(T0,T1);
-
-template<typename R. typename T0, typename T1, typename T2>
-R overloaded(T0,T1,T2);
-
-

- we can pick any of the three overloads and instantiate the template with template - arguments from a type sequence in a single expression: -

-
-static_cast<function_pointer<Seq>::type>(& overloaded)
-
-

- This technique can be occasionally more flexible than template argument deduction - from a function call because the exact types from the sequence are used to - specialize the template (including possibly cv-qualified reference types and - the result type). It is applied twice in the interface - example. -

-

- Another interersting property of callable, builtin types is that they can be - valid types for non-type template parameters. This way, a function can be pinpointed - at compile time, allowing the compiler to eliminate the call by inlining. The - fast_mem_fn example - exploits this characteristic and implements a potentially inlining version - of boost::mem_fn limited to - member functions that are known at compile time. -

-
- - - -
Copyright © 2004 -2007 Tobias Schwinger
-
-
-PrevUpHomeNext -
- - diff --git a/doc/html/boostbook.css b/doc/html/boostbook.css deleted file mode 100644 index 858d43c..0000000 --- a/doc/html/boostbook.css +++ /dev/null @@ -1,528 +0,0 @@ -/*============================================================================= - Copyright (c) 2004 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ - -/*============================================================================= - Body defaults -=============================================================================*/ - - body - { - margin: 1em; - font-family: sans-serif; - } - -/*============================================================================= - Paragraphs -=============================================================================*/ - - p - { - text-align: left; - font-size: 10pt; - line-height: 1.15; - } - -/*============================================================================= - Program listings -=============================================================================*/ - - /* Code on paragraphs */ - p tt.computeroutput - { - font-size: 9pt; - } - - pre.synopsis - { - font-size: 90%; - margin: 1pc 4% 0pc 4%; - padding: 0.5pc 0.5pc 0.5pc 0.5pc; - } - - .programlisting, - .screen - { - font-size: 9pt; - display: block; - margin: 1pc 4% 0pc 4%; - padding: 0.5pc 0.5pc 0.5pc 0.5pc; - } - - /* Program listings in tables don't get borders */ - td .programlisting, - td .screen - { - margin: 0pc 0pc 0pc 0pc; - padding: 0pc 0pc 0pc 0pc; - } - -/*============================================================================= - Headings -=============================================================================*/ - - h1, h2, h3, h4, h5, h6 - { - text-align: left; - margin: 1em 0em 0.5em 0em; - font-weight: bold; - } - - h1 { font: 140% } - h2 { font: bold 140% } - h3 { font: bold 130% } - h4 { font: bold 120% } - h5 { font: italic 110% } - h6 { font: italic 100% } - - /* Top page titles */ - title, - h1.title, - h2.title - h3.title, - h4.title, - h5.title, - h6.title, - .refentrytitle - { - font-weight: bold; - margin-bottom: 1pc; - } - - h1.title { font-size: 140% } - h2.title { font-size: 140% } - h3.title { font-size: 130% } - h4.title { font-size: 120% } - h5.title { font-size: 110% } - h6.title { font-size: 100% } - - .section h1 - { - margin: 0em 0em 0.5em 0em; - font-size: 140%; - } - - .section h2 { font-size: 140% } - .section h3 { font-size: 130% } - .section h4 { font-size: 120% } - .section h5 { font-size: 110% } - .section h6 { font-size: 100% } - - /* Code on titles */ - h1 tt.computeroutput { font-size: 140% } - h2 tt.computeroutput { font-size: 140% } - h3 tt.computeroutput { font-size: 130% } - h4 tt.computeroutput { font-size: 120% } - h5 tt.computeroutput { font-size: 110% } - h6 tt.computeroutput { font-size: 100% } - -/*============================================================================= - Author -=============================================================================*/ - - h3.author - { - font-size: 100% - } - -/*============================================================================= - Lists -=============================================================================*/ - - li - { - font-size: 10pt; - line-height: 1.3; - } - - /* Unordered lists */ - ul - { - text-align: left; - } - - /* Ordered lists */ - ol - { - text-align: left; - } - -/*============================================================================= - Links -=============================================================================*/ - - a - { - text-decoration: none; /* no underline */ - } - - a:hover - { - text-decoration: underline; - } - -/*============================================================================= - Spirit style navigation -=============================================================================*/ - - .spirit-nav - { - text-align: right; - } - - .spirit-nav a - { - color: white; - padding-left: 0.5em; - } - - .spirit-nav img - { - border-width: 0px; - } - -/*============================================================================= - Table of contents -=============================================================================*/ - - .toc - { - margin: 1pc 4% 0pc 4%; - padding: 0.1pc 1pc 0.1pc 1pc; - font-size: 80%; - line-height: 1.15; - } - - .boost-toc - { - float: right; - padding: 0.5pc; - } - -/*============================================================================= - Tables -=============================================================================*/ - - .table-title, - div.table p.title - { - margin-left: 4%; - padding-right: 0.5em; - padding-left: 0.5em; - } - - .informaltable table, - .table table - { - width: 92%; - margin-left: 4%; - margin-right: 4%; - } - - div.informaltable table, - div.table table - { - padding: 4px; - } - - /* Table Cells */ - div.informaltable table tr td, - div.table table tr td - { - padding: 0.5em; - text-align: left; - font-size: 9pt; - } - - div.informaltable table tr th, - div.table table tr th - { - padding: 0.5em 0.5em 0.5em 0.5em; - border: 1pt solid white; - font-size: 80%; - } - -/*============================================================================= - Blurbs -=============================================================================*/ - - div.note, - div.tip, - div.important, - div.caution, - div.warning, - div.sidebar - { - font-size: 9pt; /* A little bit smaller than the main text */ - line-height: 1.2; - display: block; - margin: 1pc 4% 0pc 4%; - padding: 0.5pc 0.5pc 0.0pc 0.5pc; - } - - div.sidebar img - { - padding: 1pt; - } - -/*============================================================================= - Callouts -=============================================================================*/ - .line_callout_bug img - { - float: left; - position:relative; - left: 4px; - top: -12px; - clear: left; - margin-left:-22px; - } - - .callout_bug img - { - } - -/*============================================================================= - Variable Lists -=============================================================================*/ - - /* Make the terms in definition lists bold */ - div.variablelist dl dt, - span.term - { - font-weight: bold; - font-size: 10pt; - } - - div.variablelist table tbody tr td - { - text-align: left; - vertical-align: top; - padding: 0em 2em 0em 0em; - font-size: 10pt; - margin: 0em 0em 0.5em 0em; - line-height: 1; - } - - div.variablelist dl dt - { - margin-bottom: 0.2em; - } - - div.variablelist dl dd - { - margin: 0em 0em 0.5em 2em; - font-size: 10pt; - } - - div.variablelist table tbody tr td p, - div.variablelist dl dd p - { - margin: 0em 0em 0.5em 0em; - line-height: 1; - } - -/*============================================================================= - Misc -=============================================================================*/ - - /* Title of books and articles in bibliographies */ - span.title - { - font-style: italic; - } - - span.underline - { - text-decoration: underline; - } - - span.strikethrough - { - text-decoration: line-through; - } - - /* Copyright, Legal Notice */ - div div.legalnotice p - { - text-align: left - } - -/*============================================================================= - Colors -=============================================================================*/ - - @media screen - { - /* Links */ - a - { - color: #005a9c; - } - - a:visited - { - color: #9c5a9c; - } - - h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, - h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover, - h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited - { - text-decoration: none; /* no underline */ - color: #000000; - } - - /* Syntax Highlighting */ - .keyword { color: #0000AA; } - .identifier { color: #000000; } - .special { color: #707070; } - .preprocessor { color: #402080; } - .char { color: teal; } - .comment { color: #800000; } - .string { color: teal; } - .number { color: teal; } - .white_bkd { background-color: #FFFFFF; } - .dk_grey_bkd { background-color: #999999; } - - /* Copyright, Legal Notice */ - .copyright - { - color: #666666; - font-size: small; - } - - div div.legalnotice p - { - color: #666666; - } - - /* Program listing */ - pre.synopsis - { - border: 1px solid #DCDCDC; - } - - .programlisting, - .screen - { - border: 1px solid #DCDCDC; - } - - td .programlisting, - td .screen - { - border: 0px solid #DCDCDC; - } - - /* Blurbs */ - div.note, - div.tip, - div.important, - div.caution, - div.warning, - div.sidebar - { - border: 1px solid #DCDCDC; - } - - /* Table of contents */ - .toc - { - border: 1px solid #DCDCDC; - } - - /* Tables */ - div.informaltable table tr td, - div.table table tr td - { - border: 1px solid #DCDCDC; - } - - div.informaltable table tr th, - div.table table tr th - { - background-color: #F0F0F0; - border: 1px solid #DCDCDC; - } - - /* Misc */ - span.highlight - { - color: #00A000; - } - } - - @media print - { - /* Links */ - a - { - color: black; - } - - a:visited - { - color: black; - } - - .spirit-nav - { - display: none; - } - - /* Program listing */ - pre.synopsis - { - border: 1px solid gray; - } - - .programlisting, - .screen - { - border: 1px solid gray; - } - - td .programlisting, - td .screen - { - border: 0px solid #DCDCDC; - } - - /* Table of contents */ - .toc - { - border: 1px solid gray; - } - - .informaltable table, - .table table - { - border: 1px solid gray; - border-collapse: collapse; - } - - /* Tables */ - div.informaltable table tr td, - div.table table tr td - { - border: 1px solid gray; - } - - div.informaltable table tr th, - div.table table tr th - { - border: 1px solid gray; - } - - /* Misc */ - span.highlight - { - font-weight: bold; - } - } diff --git a/doc/html/index.html b/doc/html/index.html deleted file mode 100644 index 358b001..0000000 --- a/doc/html/index.html +++ /dev/null @@ -1,55 +0,0 @@ - - - -Chapter 1. Boost.FunctionTypes 2.5 - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
Next
-
-
-

-Chapter 1. Boost.FunctionTypes 2.5

-

-Tobias Schwinger -

-
-
-

- 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) -

-
-
- -
- - - -

Last revised: May 13, 2007 at 13:12:48 GMT

-
-
Next
- - diff --git a/example/Jamfile b/example/Jamfile deleted file mode 100644 index 08ab43d..0000000 --- a/example/Jamfile +++ /dev/null @@ -1,20 +0,0 @@ - -# (C) Copyright Tobias Schwinger -# -# Use, modification and distribution are subject to the Boost Software License, -# Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -#------------------------------------------------------------------------------- - -exe interpreter_example : interpreter_example.cpp ; - -exe result_of_example : result_of_example.cpp ; - -exe interface_example : interface_example.cpp ; - -exe fast_mem_fn_example : fast_mem_fn_example.cpp - : . ; # needed for Boost.PP file iteration with some compilers - -exe macro_type_args_example : macro_type_args_example.cpp ; - - diff --git a/example/detail/param_type.hpp b/example/detail/param_type.hpp deleted file mode 100644 index 7c0fd5f..0000000 --- a/example/detail/param_type.hpp +++ /dev/null @@ -1,71 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -// Metafunction to compute optimal parameter type for argument forwarding. - -// This header is not an FT example in itself -- it's used by some of them to -// optimize argument forwarding. -// -// For more details see 'fast_mem_fn.hpp' in this directory or the documentation -// of the CallTraits utility [1]. -// -// -// References -// ========== -// -// [1] http://www.boost.org/libs/utility/call_traits.htm - -#ifndef BOOST_UTILITY_PARAM_TYPE_HPP_INCLUDED -#define BOOST_UTILITY_PARAM_TYPE_HPP_INCLUDED - -#include - -#include -#include - -#include -#include - -#include -// #include - -// namespace boost -namespace example -{ - namespace mpl = boost::mpl; - - // namespace utility - // { - namespace param_type_detail - { - template - struct by_ref_cond - { - typedef by_ref_cond type; - BOOST_STATIC_CONSTANT(bool,value = sizeof(void*) < sizeof(T)); - }; - - template - struct add_ref_to_const - : boost::add_reference< typename boost::add_const::type > - { }; - } - - template - struct param_type - : mpl::eval_if< param_type_detail::by_ref_cond - , param_type_detail::add_ref_to_const, mpl::identity > - { - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,param_type,(T)) - }; - // } - // BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,utility::param_type) -} - -#endif - diff --git a/example/fast_mem_fn.hpp b/example/fast_mem_fn.hpp deleted file mode 100644 index 97f95b0..0000000 --- a/example/fast_mem_fn.hpp +++ /dev/null @@ -1,248 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ -// -// This example implements a very efficient, generic member function wrapper. -// -// -// Detailed description -// ==================== -// -// For most platforms C++ runs on (maybe all hardware platforms, as opposed to -// virtual machines) there are indirect calls that take more time to execute -// than direct ones. Further calling a function usually takes more time than -// inlining it at the call site. -// -// A direct call is a machine instruction that calls a subroutine at a known -// address encoded in the instruction itself. C++ compilers usually emit one of -// these instructions for each function call to a nonvirtual function (a call to -// a virtual function requires either two direct calls or one indirect call). -// An indirect call is a machine instruction that calls a subroutine at an -// address known at runtime. C++ compilers usually emit at least one of these -// instructions for a call through a callable builtin variable. -// -// It is possible to use callable scalars as non-type template arguments. This -// way the compiler knows which function we want to call when generating the -// code for the call site, so it may inline (if it decides to do so) or use a -// direct call instead of being forced to use a slow, indirect call. -// -// We define a functor class template that encodes the function to call in its -// type via a non-type template argument. Its (inline declared) overloaded -// function call operator calls the function through that non-type template -// argument. In the best case we end up inlining the callee directly at the -// point of the call. -// -// Decomposition of the wrapped member function's type is needed in order to -// implement argument forwarding (just using a templated call operator we would -// encounter what is known as "the forwarding problem" [Dimov1]). Further we -// can eliminate unecessary copies for each by-value parameter by using a -// reference to its const qualified type for the corresponding parameter of the -// wrapper's function call operator. -// -// Finally we provide a macro that does have similar semantics to the function -// template mem_fn of the Bind [2] library. -// We can't use a function template and use a macro instead, because we use a -// member function pointer that is a compile time constant. So we first have to -// deduce the type and create a template that accepts this type as a non-type -// template argument, which is passed in in a second step. The macro hides this -// lengthy expression from the user. -// -// -// Limitations -// =========== -// -// The "this-argument" must be specified as a reference. -// -// -// Bibliography -// ============ -// -// [Dimov1] Dimov, P., Hinnant H., Abrahams, D. The Forwarding Problem -// http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm -// -// [Dimov2] Dimov, P. Documentation of boost::mem_fn -// http://www.boost.org/libs/bind/mem_fn.html - -#ifndef BOOST_EXAMPLE_FAST_MEM_FN_HPP_INCLUDED -#ifndef BOOST_PP_IS_ITERATING - - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include "detail/param_type.hpp" - -namespace example -{ - - namespace ft = boost::function_types; - namespace mpl = boost::mpl; - using namespace mpl::placeholders; - - // the functor class template - template< typename MFPT, MFPT MemberFunction - , size_t Arity = ::example::ft::function_arity::value - > - struct fast_mem_fn; - - // ------- ---- --- -- - - - - - - // deduce type and capture compile time value - #define BOOST_EXAMPLE_FAST_MEM_FN(mfp) \ - ::example::make_fast_mem_fn(mfp).make_fast_mem_fn() - - template - struct fast_mem_fn_maker - { - template - fast_mem_fn make_fast_mem_fn() - { - return fast_mem_fn(); - } - }; - - template - typename boost::enable_if, - fast_mem_fn_maker >::type - make_fast_mem_fn(MFPT) - { - return fast_mem_fn_maker(); - } - - - // ------- ---- --- -- - - - - - - namespace detail - { - // by-value forwarding optimization - template - struct parameter_types - : mpl::transform_view,param_type<_> > - { }; - } - - // ------- ---- --- -- - - - - - - template< typename MFPT, MFPT MemberFunction > - struct fast_mem_fn - { - // decompose the result and the parameter types (public for introspection) - typedef typename ft::result_type::type result_type; - typedef detail::parameter_types parameter_types; - private: - // iterate the parameter types - typedef typename mpl::begin::type i0; - public: - // forwarding function call operator - result_type operator()( typename mpl::deref::type a0) const - { - return (a0.*MemberFunction)(); - }; - }; - - template< typename MFPT, MFPT MemberFunction > - struct fast_mem_fn - { - // decompose the result and the parameter types (public for introspection) - typedef typename ft::result_type::type result_type; - typedef detail::parameter_types parameter_types; - private: - // iterate the parameter types - typedef typename mpl::begin::type i0; - typedef typename mpl::next::type i1; - public: - // forwarding function call operator - result_type operator()( typename mpl::deref::type a0 - , typename mpl::deref::type a1) const - { - return (a0.*MemberFunction)(a1); - }; - }; - - template< typename MFPT, MFPT MemberFunction > - struct fast_mem_fn - { - // decompose the result and the parameter types (public for introspection) - typedef typename ft::result_type::type result_type; - typedef detail::parameter_types parameter_types; - private: - // iterate the parameter types - typedef typename mpl::begin::type i0; - typedef typename mpl::next::type i1; - typedef typename mpl::next::type i2; - public: - // forwarding function call operator - result_type operator()( typename mpl::deref::type a0 - , typename mpl::deref::type a1 - , typename mpl::deref::type a2) const - { - return (a0.*MemberFunction)(a1,a2); - }; - }; - - // ... -} - -// ------- ---- --- -- - - - - - -// preprocessor-based code generator to continue the repetitive part, above - -#include -#include -#include -#include -#include -#include - -namespace example -{ - #if BOOST_FT_MAX_ARITY >= 4 - # define BOOST_PP_FILENAME_1 "fast_mem_fn.hpp" - # define BOOST_PP_ITERATION_LIMITS (4,BOOST_FT_MAX_ARITY) - # include BOOST_PP_ITERATE() - #endif -} - -#define BOOST_EXAMPLE_FAST_MEM_FN_HPP_INCLUDED -#else - - #define N BOOST_PP_FRAME_ITERATION(1) - template< typename MFPT, MFPT MemberFunction > - struct fast_mem_fn - { - // decompose the result and the parameter types (public for introspection) - typedef typename ft::result_type::type result_type; - typedef detail::parameter_types parameter_types; - private: - // iterate the parameter types - typedef typename mpl::begin::type i0; - #define BOOST_PP_LOCAL_LIMITS (0,N-2) - #define BOOST_PP_LOCAL_MACRO(j) \ - typedef typename mpl::next< i ## j >::type BOOST_PP_CAT(i,BOOST_PP_INC(j)) ; - #include BOOST_PP_LOCAL_ITERATE() - public: - // forwarding function call operator - result_type operator()( - BOOST_PP_ENUM_BINARY_PARAMS(N, typename mpl::deref::type a) ) const - { - return (a0.*MemberFunction)(BOOST_PP_ENUM_SHIFTED_PARAMS(N,a)); - }; - }; - #undef N - -#endif -#endif - diff --git a/example/fast_mem_fn_example.cpp b/example/fast_mem_fn_example.cpp deleted file mode 100644 index efe66a1..0000000 --- a/example/fast_mem_fn_example.cpp +++ /dev/null @@ -1,118 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ -// See fast_mem_fn.hpp in this directory for details. - -#include -#include -#include -#include -#include - -#include -#include - -#include "fast_mem_fn.hpp" - -// test class that holds a single integer with getter function -class test -{ - int val_id; -public: - - explicit test(int id) - : val_id(id) - { } - - int id() const - { return val_id; } - -}; - -// STL style comparator that applies the CriterionExtractor function to both -// operands and compares the results with Comparator -template -class test_compare -{ - CriterionExtractor fnc_criterion; - Comparator fnc_compare; -public: - - explicit test_compare(CriterionExtractor criterion, Comparator compare) - : fnc_criterion(criterion) - , fnc_compare(compare) - { } - - template - inline bool operator()(T const & lhs, T const & rhs) const - { - return fnc_compare(fnc_criterion(lhs),fnc_criterion(rhs)); - } -}; - -// helper function to construct an instance of the test_compare comparator. -template -test_compare -make_test_compare(CriterionExtractor criterion, Comparator compare) -{ - return test_compare(criterion,compare); -} - -// the test case: sort N test objects by id -// -// the objects are in ascending order before the test run and in descending -// order after it - -static const unsigned N = 2000000; - -typedef std::vector test_vector; - - -void setup_test(test_vector & v) -{ - v.clear(); - v.reserve(N); - for (unsigned i = 0; i < N; ++i) - v.push_back(test(i)); -} - -template void do_test(test_vector & v, F criterion) -{ - std::sort(v.begin(),v.end(),make_test_compare(criterion,std::greater())); - assert(v.begin()->id() == N-1); -} - - -// compare performance with boost::mem_fn -int main() -{ - test_vector v; - boost::timer t; - double time1, time2; - - std::cout << - "Test case: sorting " << N << " objects.\n\n" - "Criterion accessor called with | elasped seconds\n" - "-------------------------------|----------------" << std::endl; - - setup_test(v); - t.restart(); - do_test(v, BOOST_EXAMPLE_FAST_MEM_FN(& test::id)); - time1 = t.elapsed(); - std::cout << "fast_mem_fn | " << time1 << std::endl; - - setup_test(v); - t.restart(); - do_test(v, boost::mem_fn(& test::id)); - time2 = t.elapsed(); - std::cout << "mem_fn | " << time2 << std::endl; - - std::cout << '\n' << (time2/time1-1)*100 << "% speedup" << std::endl; - - return 0; -} - diff --git a/example/interface.hpp b/example/interface.hpp deleted file mode 100644 index cadf740..0000000 --- a/example/interface.hpp +++ /dev/null @@ -1,361 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ -// -// This example implements interfaces. -// -// Detailed description -// ==================== -// -// An interface is a collection of member function prototypes that may be -// implemented by classes. Objects of classes that implement the interface can -// then be assigned to an interface variable through which the interface's -// functions can be called. -// -// Interfaces are a feature of the Java programming language [Gosling] and the -// most obvious way to model interfaces in C++ is (multiple) inheritance. -// Using inheritance for this purpose, however, is neither the most efficient -// nor the most flexible solution, because: -// -// - all functions must be virtual, -// -// => a function that calls another function of the interface must do so -// via virtual dispatch (as opposed to inlining) -// => a class can not implement an interface's (overloaded) function via -// a function template -// -// - inhertitance is intrusive -// -// => object size increases -// => client's are always polymorphic -// => dependencies cause tighter coupling -// -// Fortunately it is possible to eliminate all the drawbacks mentioned above -// based on an alternative implementation proposed by David Abrahams. -// We'll add some detail to the original scheme (see [Abrahams]) such as -// support for overloaded and const qualified functions. -// The implementation in this example uses Boost.FunctionTypes to shift -// metaprogramming code from the preprocessor into templates, to reduce -// preprocessing time and increase maintainability. -// -// -// Limitations -// =========== -// -// There is no lifetime management as implemented by the Boost candidate -// Interfaces library (see [Turkanis]). -// -// This example does not compile with Visual C++. Template argument deduction -// from the result of the address-of operator does not work properly with this -// compiler. It is possible to partially work around the problem, but it isn't -// done here for the sake of readability. -// -// -// Bibliography -// ============ -// -// [Gosling] Gosling, J., Joy, B., Steele, G. The Java Language Specification -// http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html -// -// [Abrahams] Abrahams, D. Proposal: interfaces, Post to newsgroup comp.std.c++ -// http://groups.google.com/group/comp.std.c++/msg/85af30a61bf677e4 -// -// [Turkanis] Turkanis, J., Diggins, C. Boost candidate Interfaces library -// http://www.kangaroologic.com/interfaces/libs/interfaces/doc/index.html - -#include - -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "detail/param_type.hpp" - -namespace example -{ - namespace ft = boost::function_types; - namespace mpl = boost::mpl; - using namespace mpl::placeholders; - - // join a single type and an MPL-sequence - // in some ways similar to mpl::push_front (but mpl::push_front requires - // an MPL Extensible Sequence and this template does not) - template - struct concat_view - : mpl::joint_view, Seq> - { }; - - // metafunction returning a function pointer type for a vtable entry - template - struct vtable_entry - : ft::function_pointer - < concat_view< typename Inf::result, mpl::transform_view< - typename Inf::params, param_type<_> > > > - { }; - - // the expression '& member::wrap<& Class::Function> ' in an - // assignment context binds the member function Function of Class with the - // properties described by MetaInfo and Tag to the corresponding vtable - // entry - template - struct member - { - typedef typename ft::member_function_pointer - < concat_view,Tag - >::type - mem_func_ptr; - - typedef typename mpl::at_c::type context; - - template - static typename Inf::result wrap(void* c) - { - return (reinterpret_cast(c)->*MemFuncPtr)(); - } - template - static typename Inf::result wrap(void* c, T0 a0) - { - return (reinterpret_cast(c)->*MemFuncPtr)(a0); - } - template - static typename Inf::result wrap(void* c, T0 a0, T1 a1) - { - return (reinterpret_cast(c)->*MemFuncPtr)(a0,a1); - } - // continue with the preprocessor (the scheme should be clear, by now) - #define BOOST_PP_LOCAL_MACRO(n) \ - template \ - static typename Inf::result wrap(void* c, \ - BOOST_PP_ENUM_BINARY_PARAMS(n,T,a)) \ - { \ - return (reinterpret_cast(c)->*MemFuncPtr)( \ - BOOST_PP_ENUM_PARAMS(n,a) ); \ - } - #define BOOST_PP_LOCAL_LIMITS (3,BOOST_FT_MAX_ARITY-1) - #include BOOST_PP_LOCAL_ITERATE() - }; - - // extract a parameter by index - template - struct param - : param_type< typename mpl::at_c< typename Inf::params,Index>::type > - { }; -} - -// the interface definition on the client's side -#define BOOST_EXAMPLE_INTERFACE(name,def) \ - class name \ - { \ - struct vtable \ - { \ - BOOST_EXAMPLE_INTERFACE__MEMBERS(def,VTABLE) \ - }; \ - \ - vtable const * ptr_vtable; \ - void * ptr_that; \ - \ - template struct vtable_holder \ - { \ - static vtable const val_vtable; \ - }; \ - \ - public: \ - \ - template \ - inline name (T & that) \ - : ptr_vtable(& vtable_holder::val_vtable) \ - , ptr_that(boost::addressof(that)) \ - { } \ - \ - BOOST_EXAMPLE_INTERFACE__MEMBERS(def,FUNCTION) \ - }; \ - \ - template \ - name ::vtable const name ::vtable_holder::val_vtable \ - = { BOOST_EXAMPLE_INTERFACE__MEMBERS(def,INIT_VTABLE) } - - -#ifdef BOOST_PP_NIL // never defined -- a comment with syntax highlighting - -BOOST_EXAMPLE_INTERFACE( interface_x, - (( a_func, (void)(int), const_qualified )) - (( another_func, (int), non_const )) -); - -// expands to: -class interface_x -{ - struct vtable - { - // meta information for first function - template struct inf0 - { - typedef void result; - typedef ::boost::mpl::vector< T, int > params; - }; - // function pointer with void* context pointer and parameters optimized - // for forwarding - ::example::vtable_entry >::type func0; - - // second function - template struct inf1 - { - typedef int result; - typedef ::boost::mpl::vector< T > params; - }; - ::example::vtable_entry >::type func1; - }; - - // data members - vtable const * ptr_vtable; - void * ptr_that; - - // this template is instantiated for every class T this interface is created - // from, causing the compiler to emit an initialized vtable for this type - // (see aggregate assignment, below) - template struct vtable_holder - { - static vtable const val_vtable; - }; - -public: - - // converting ctor, creates an interface from an arbitrary class - template - inline interface_x (T & that) - : ptr_vtable(& vtable_holder::val_vtable) - , ptr_that(boost::addressof(that)) - { } - - // the member functions from the interface definition, parameters are - // optimized for forwarding - - inline vtable::inf0<> ::result a_func ( - ::example::param,1>::type p0) const - { - return ptr_vtable-> func0(ptr_that , p0); - } - - inline vtable::inf1<> ::result another_func () - { - return ptr_vtable-> func1(ptr_that ); - } -}; - -template -interface_x ::vtable const interface_x ::vtable_holder::val_vtable = -{ - // instantiate function templates that wrap member function pointers (which - // are known at compile time) by taking their addresses in assignment to - // function pointer context - & ::example::member< vtable::inf0, ::example::ft:: const_qualified > - ::template wrap < &T:: a_func > -, & ::example::member< vtable::inf1, ::example::ft:: non_const > - ::template wrap < &T:: another_func > -}; -#endif - -// preprocessing code details - -// iterate all of the interface's members and invoke a macro (prefixed with -// BOOST_EXAMPLE_INTERFACE_) -#define BOOST_EXAMPLE_INTERFACE__MEMBERS(seq,macro) \ - BOOST_PP_REPEAT(BOOST_PP_SEQ_SIZE(seq), \ - BOOST_EXAMPLE_INTERFACE__ ## macro,seq) - -// extract signature sequence from entry -#define BOOST_EXAMPLE_INTERFACE__VTABLE(z,i,seq) \ - BOOST_EXAMPLE_INTERFACE__VTABLE_I(z,i, \ - BOOST_PP_TUPLE_ELEM(3,1,BOOST_PP_SEQ_ELEM(i,seq))) - -// split the signature sequence result/params and insert T at the beginning of -// the params part -#define BOOST_EXAMPLE_INTERFACE__VTABLE_I(z,i,seq) \ - BOOST_EXAMPLE_INTERFACE__VTABLE_II(z,i, \ - BOOST_PP_SEQ_HEAD(seq),(T)BOOST_PP_SEQ_TAIL(seq)) - -// emit the meta information structure and function pointer declaration -#define BOOST_EXAMPLE_INTERFACE__VTABLE_II(z,i,result_type,param_types) \ - template \ - struct BOOST_PP_CAT(inf,i) \ - { \ - typedef result_type result; \ - typedef ::boost::mpl::vector< BOOST_PP_SEQ_ENUM(param_types) > params; \ - }; \ - ::example::vtable_entry >::type BOOST_PP_CAT(func,i); - -// extract tuple entry from sequence and precalculate the name of the function -// pointer variable -#define BOOST_EXAMPLE_INTERFACE__INIT_VTABLE(z,i,seq) \ - BOOST_EXAMPLE_INTERFACE__INIT_VTABLE_I(i,seq,BOOST_PP_CAT(func,i), \ - BOOST_PP_SEQ_ELEM(i,seq)) - -// emit a function pointer expression that encapsulates the corresponding -// member function of T -#define BOOST_EXAMPLE_INTERFACE__INIT_VTABLE_I(i,seq,func,desc) \ - BOOST_PP_COMMA_IF(i) & ::example::member< BOOST_PP_CAT(vtable::inf,i), \ - ::example::ft:: BOOST_PP_TUPLE_ELEM(3,2,desc) >::template wrap \ - < &T:: BOOST_PP_TUPLE_ELEM(3,0,desc) > - -// extract tuple entry from sequence -#define BOOST_EXAMPLE_INTERFACE__FUNCTION(z,i,seq) \ - BOOST_EXAMPLE_INTERFACE__FUNCTION_I(z,i,BOOST_PP_SEQ_ELEM(i,seq)) - -// precalculate function name, arity, name of meta info structure and cv- -// qualifiers -#define BOOST_EXAMPLE_INTERFACE__FUNCTION_I(z,i,desc) \ - BOOST_EXAMPLE_INTERFACE__FUNCTION_II(z,i, \ - BOOST_PP_TUPLE_ELEM(3,0,desc), \ - BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(3,1,desc))), \ - BOOST_PP_CAT(vtable::inf,i)<>, \ - BOOST_PP_CAT(BOOST_EXAMPLE_INTERFACE___,BOOST_PP_TUPLE_ELEM(3,2,desc)) \ - ) - -// emit the definition for a member function of the interface -#define BOOST_EXAMPLE_INTERFACE__FUNCTION_II(z,i,name,arity,types,cv) \ - inline types ::result name \ - (BOOST_PP_ENUM_ ## z (arity,BOOST_EXAMPLE_INTERFACE__PARAM,types)) cv() \ - { \ - return ptr_vtable-> BOOST_PP_CAT(func,i)(ptr_that \ - BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,arity,p)); \ - } - -// emit a parameter of the function definition -#define BOOST_EXAMPLE_INTERFACE__PARAM(z,j,types) \ - ::example::param::type BOOST_PP_CAT(p,j) - -// helper macros to map 'const_qualified' to 'const' an 'non_const' to '' -#define BOOST_EXAMPLE_INTERFACE___const_qualified BOOST_PP_IDENTITY(const) -#define BOOST_EXAMPLE_INTERFACE___non_const BOOST_PP_EMPTY - - diff --git a/example/interface_example.cpp b/example/interface_example.cpp deleted file mode 100644 index d4f66bb..0000000 --- a/example/interface_example.cpp +++ /dev/null @@ -1,79 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ -// See interface.hpp in this directory for details. - -#include - -#include "interface.hpp" - - -BOOST_EXAMPLE_INTERFACE( interface_x, - (( a_func, (void)(int) , const_qualified )) - (( a_func, (void)(long), const_qualified )) - (( another_func, (int) , non_const )) -); - - -// two classes that implement interface_x - -struct a_class -{ - void a_func(int v) const - { - std::cout << "a_class::void a_func(int v = " << v << ")" << std::endl; - } - - void a_func(long v) const - { - std::cout << "a_class::void a_func(long v = " << v << ")" << std::endl; - } - - int another_func() - { - std::cout << "a_class::another_func() = 3" << std::endl; - return 3; - } -}; - -struct another_class -{ - // note: overloaded a_func implemented as a function template - template - void a_func(T v) const - { - std::cout << - "another_class::void a_func(T v = " << v << ")" - " [ T = " << typeid(T).name() << " ]" << std::endl; - } - - int another_func() - { - std::cout << "another_class::another_func() = 5" << std::endl; - return 5; - } -}; - - -// both classes above can be assigned to the interface variable and their -// member functions can be called through it -int main() -{ - a_class x; - another_class y; - - interface_x i(x); - i.a_func(12); - i.a_func(77L); - i.another_func(); - - i = y; - i.a_func(13); - i.a_func(21L); - i.another_func(); -} - diff --git a/example/interpreter.hpp b/example/interpreter.hpp deleted file mode 100644 index 9e75bf7..0000000 --- a/example/interpreter.hpp +++ /dev/null @@ -1,188 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ -// -// This example implements a simple batch-style interpreter that is capable of -// calling functions previously registered with it. The parameter types of the -// functions are used to control the parsing of the input. -// -// Implementation description -// ========================== -// -// When a function is registered, an 'invoker' template is instantiated with -// the function's type. The 'invoker' fetches a value from the 'token_parser' -// for each parameter of the function into a tuple and finally invokes the the -// function with these values as arguments. The invoker's entrypoint, which -// is a function of the callable builtin that describes the function to call and -// a reference to the 'token_parser', is partially bound to the registered -// function and put into a map so it can be found by name during parsing. - -#include -#include -#include - -#include -#include - -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include - -namespace example -{ - namespace fusion = boost::fusion; - namespace ft = boost::function_types; - namespace mpl = boost::mpl; - - class interpreter - { - class token_parser; - typedef boost::function invoker_function; - typedef std::map dictionary; - - dictionary map_invokers; - public: - // Registers a function with the interpreter. - template - typename boost::enable_if< ft::is_nonmember_callable_builtin - >::type register_function(std::string const & name, Function f); - - // Parse input for functions to call. - void parse_input(std::string const & text) const; - - private: - template< typename Function - , class From = typename mpl::begin< ft::parameter_types >::type - , class To = typename mpl::end< ft::parameter_types >::type - > - struct invoker; - }; - - class interpreter::token_parser - { - typedef boost::token_iterator_generator< - boost::char_separator >::type token_iterator; - - token_iterator itr_at, itr_to; - public: - - token_parser(token_iterator from, token_iterator to) - : itr_at(from), itr_to(to) - { } - - private: - template - struct remove_cv_ref - : boost::remove_cv< typename boost::remove_reference::type > - { }; - public: - // Returns a token of given type. - // We just apply boost::lexical_cast to whitespace separated string tokens - // for simplicity. - template - typename remove_cv_ref::type get() - { - if (! this->has_more_tokens()) - throw std::runtime_error("unexpected end of input"); - - try - { - typedef typename remove_cv_ref::type result_type; - result_type result = boost::lexical_cast - ::type>(*this->itr_at); - ++this->itr_at; - return result; - } - - catch (boost::bad_lexical_cast &) - { throw std::runtime_error("invalid argument: " + *this->itr_at); } - } - - // Any more tokens? - bool has_more_tokens() const { return this->itr_at != this->itr_to; } - }; - - template - struct interpreter::invoker - { - // add an argument to a Fusion cons-list for each parameter type - template - static inline - void apply(Function func, token_parser & parser, Args const & args) - { - typedef typename mpl::deref::type arg_type; - - invoker::type, To>::apply - ( func, parser, fusion::push_back(args, parser.get()) ); - } - }; - - template - struct interpreter::invoker - { - // the argument list is complete, now call the function - template - static inline - void apply(Function func, token_parser &, Args const & args) - { - fusion::invoke(func,args); - } - }; - - template - typename boost::enable_if< ft::is_nonmember_callable_builtin >::type - interpreter::register_function(std::string const & name, Function f) - { - // instantiate and store the invoker by name - this->map_invokers[name] = boost::bind( - & invoker::template apply, f,_1,fusion::nil() ); - } - - - void interpreter::parse_input(std::string const & text) const - { - boost::char_separator s(" \t\n\r"); - - token_parser parser - ( boost::make_token_iterator(text.begin(), text.end(), s) - , boost::make_token_iterator(text.end() , text.end(), s) ); - - while (parser.has_more_tokens()) - { - // read function name - std::string func_name = parser.get(); - - // look up function - dictionary::const_iterator entry = map_invokers.find( func_name ); - if (entry == map_invokers.end()) - throw std::runtime_error("unknown function: " + func_name); - - // call the invoker which controls argument parsing - entry->second(parser); - } - } - -} - diff --git a/example/interpreter_example.cpp b/example/interpreter_example.cpp deleted file mode 100644 index 9e6118b..0000000 --- a/example/interpreter_example.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include - -#include "interpreter.hpp" - -void echo(std::string const & s) -{ - std::cout << s << std::endl; -} - -void add(int a, int b) -{ - std::cout << a + b << std::endl; -} - -void repeat(std::string const & s, int n) -{ - while (--n >= 0) std::cout << s; - std::cout << std::endl; -} - -int main() -{ - example::interpreter interpreter; - - interpreter.register_function("echo", & echo); - interpreter.register_function("add", & add); - interpreter.register_function("repeat", & repeat); - - std::string line = "nonempty"; - while (! line.empty()) - { - std::cout << std::endl << "] ", std::getline(std::cin,line); - - try - { - interpreter.parse_input(line); - } - catch (std::runtime_error &error) - { - std::cerr << error.what() << std::endl; - } - } - - return 0; -} - diff --git a/example/macro_type_args.hpp b/example/macro_type_args.hpp deleted file mode 100644 index 3500524..0000000 --- a/example/macro_type_args.hpp +++ /dev/null @@ -1,73 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ -// -// This example implements a utility to accept a type expression, that may -// contain commas to a macro. -// -// -// Detailed description -// ==================== -// -// Accepting a type as macro argument can cause problems if the type expression -// contains commas: -// -// #define MY_MACRO(a_type) -// ... -// MY_MACRO(std::map) // ERROR (wrong number of macro arguments) -// -// This problem can be solved by pasing using a parenthesized type -// -// MY_MACRO((std::map) // OK -// -// but then there is no way to remove the parentheses in the macro argument -// with the preprocessor. -// We can, however, form a pointer to a function with a single argument (the -// parentheses become part of the type) and extract the argument with template -// metaprogramming: -// -// // Inside the macro definition -// -// typename mpl::front< parameter_types >::type -// -// This code snippet does not read too expressive so we use another macro -// to encapsulate the solution: -// -// // Inside the macro definition -// -// BOOST_EXAMPLE_MACRO_TYPE_ARGUMENT(a_type) -// -// As a generalization of this technique we can accept a comma-separated list of -// types. Omitting the mpl::front invocation gives us an MPL-sequence. -// -// -// Limitations -// =========== -// -// - only works for types that are valid function arguments -// -// Acknowledgments -// =============== -// -// Thanks go to Dave Abrahams for letting me know this technique. - -#ifndef BOOST_EXAMPLE_MACRO_TYPE_ARGUMENT_HPP_INCLUDED -#define BOOST_EXAMPLE_MACRO_TYPE_ARGUMENT_HPP_INCLUDED - -#include -#include - -#define BOOST_EXAMPLE_MACRO_TYPE_ARGUMENT(parenthesized_type) \ - boost::mpl::front< \ - BOOST_EXAMPLE_MACRO_TYPE_LIST_ARGUMENT(parenthesized_type) >::type - -#define BOOST_EXAMPLE_MACRO_TYPE_LIST_ARGUMENT(parenthesized_types) \ - ::boost::function_types::parameter_types< void(*) parenthesized_types > - - -#endif - diff --git a/example/macro_type_args_example.cpp b/example/macro_type_args_example.cpp deleted file mode 100644 index 9f83883..0000000 --- a/example/macro_type_args_example.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ -// See macro_type_arugment.hpp in this directory for details. - -#include -#include -#include - -#include -#include - -#include "macro_type_args.hpp" - - -#define TYPE_NAME(parenthesized_type) \ - typeid(BOOST_EXAMPLE_MACRO_TYPE_ARGUMENT(parenthesized_type)).name() - -namespace example -{ - namespace mpl = boost::mpl; - - template - struct mpl_seq_to_string_impl - { - static std::string get(std::string const & prev) - { - typedef typename mpl::next::type next_pos; - typedef typename mpl::deref::type type; - - return mpl_seq_to_string_impl::get( - prev + (prev.empty()? '\0' : ',') + typeid(type).name() ); - } - }; - template - struct mpl_seq_to_string_impl - { - static std::string get(std::string const & prev) - { - return prev; - } - }; - - template - std::string mpl_seq_to_string() - { - typedef typename mpl::begin::type begin; - typedef typename mpl::end::type end; - - return mpl_seq_to_string_impl::get(""); - } - -} - -#define TYPE_NAMES(parenthesized_types) \ - ::example::mpl_seq_to_string< \ - BOOST_EXAMPLE_MACRO_TYPE_LIST_ARGUMENT(parenthesized_types) >() - -int main() -{ - std::cout << TYPE_NAME((int)) << std::endl; - - std::cout << TYPE_NAMES((int,char)) << std::endl; - std::cout << TYPE_NAMES((int,char,long)) << std::endl; - -} - diff --git a/example/result_of.hpp b/example/result_of.hpp deleted file mode 100644 index 1527221..0000000 --- a/example/result_of.hpp +++ /dev/null @@ -1,86 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ -// -// Reimplementation of the Boost result_of utility (see [Gregor01] and -// [Gregor02]). -// -// -// Detailed description -// ==================== -// -// This example implements the functionality of the Boost result_of utility. -// Because of FunctionTypes we get away without repetitive code and the Boost -// Preprocessor library. -// -// -// Bibliography -// ============ -// -// [Gregor01] Gregor, D. The Boost result_of utility -// http://www.boost.org/libs/utility -// -// [Gregor02] Gregor, D. A uniform method for computing function object return -// types (revision 1) -// http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1454.html - -#include -#include - -#include -#include - -namespace example -{ - namespace ft = boost::function_types; - namespace mpl = boost::mpl; - - template struct result_of; - - namespace detail - { - BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) - - template - struct result_type_member - { - typedef typename F::result_type type; - }; - - template - struct result_member_template - { - typedef typename F::template result::type type; - }; - -#if !BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x564)) - template - struct result_member_template< F, F(void) > - { - typedef void type; - }; -#endif - - template - struct result_of_impl - : mpl::eval_if - < ft::is_callable_builtin - , ft::result_type - , mpl::eval_if - < has_result_type - , result_type_member - , result_member_template - > > - { }; - } - - template - struct result_of - : detail::result_of_impl< typename ft::result_type::type, Desc > - { }; -} - diff --git a/example/result_of_example.cpp b/example/result_of_example.cpp deleted file mode 100644 index a8fe2d2..0000000 --- a/example/result_of_example.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// (C) Copyright Douglas Gregor 2003-2004. -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ -// This file is a modified copy of the original Boost.ResultOf test-suite. -// See result_of.hpp in this directory for details. - - -#include "result_of.hpp" - -#include -#include -#include - -struct int_result_type { typedef int result_type; }; - -struct int_result_of -{ - template struct result { typedef int type; }; -}; - -struct int_result_type_and_float_result_of -{ - typedef int result_type; - template struct result { typedef float type; }; -}; - -struct X {}; - -int main() -{ - using namespace boost; - namespace e = example; - - typedef int (*func_ptr)(float, double); - typedef int (&func_ref)(float, double); - typedef int (X::*mem_func_ptr)(float); - typedef int (X::*mem_func_ptr_c)(float) const; - typedef int (X::*mem_func_ptr_v)(float) volatile; - typedef int (X::*mem_func_ptr_cv)(float) const volatile; - - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - BOOST_STATIC_ASSERT((is_same::type, void>::value)); - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - BOOST_STATIC_ASSERT((is_same::type, void>::value)); - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - return 0; -} diff --git a/index.html b/index.html deleted file mode 100644 index ee4ce6e..0000000 --- a/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - -

Automatic redirection failed, please go to - doc/html/index.html.

-

Copyright Tobias Schwinger 2005-2007

-

Distributed under the Boost Software License, Version 1.0. (See accompanying file - LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt).

- - - diff --git a/test/Jamfile b/test/Jamfile deleted file mode 100644 index 34658ee..0000000 --- a/test/Jamfile +++ /dev/null @@ -1,85 +0,0 @@ - -# (C) Copyright Tobias Schwinger -# -# Use, modification and distribution are subject to the Boost Software License, -# Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -#------------------------------------------------------------------------------- - -import testing ; - -{ - test-suite function_types : - - # Classification - - [ compile classification/is_function.cpp ] - [ compile classification/is_function_pointer.cpp ] - [ compile classification/is_function_reference.cpp ] - [ compile classification/is_member_function_pointer.cpp ] - [ compile classification/is_member_object_pointer.cpp ] - [ compile classification/is_callable_builtin.cpp ] - [ compile classification/is_nonmember_callable_builtin.cpp ] - [ compile classification/is_member_pointer.cpp ] - - [ compile classification/is_cv_mem_func_ptr.cpp ] - [ compile classification/is_variadic.cpp ] - [ compile classification/is_cv_pointer.cpp ] - # [ compile classification/is_cv_function.cpp ] - - # Decomposition - - [ compile decomposition/components.cpp ] - [ compile decomposition/result_type.cpp ] - [ compile decomposition/function_arity.cpp ] - [ compile decomposition/parameter_types.cpp ] - - [ compile decomposition/components_seq.cpp ] - [ compile decomposition/class_type_transform.cpp ] - - [ compile-fail decomposition/result_type_fail.cpp ] - [ compile-fail decomposition/parameter_types_fail.cpp ] - [ compile-fail decomposition/function_arity_fail.cpp ] - - # Synthesis - - [ compile synthesis/function_type.cpp ] - [ compile synthesis/function_pointer.cpp ] - [ compile synthesis/function_reference.cpp ] - [ compile synthesis/member_function_pointer.cpp ] - [ compile synthesis/member_object_pointer.cpp ] - - [ compile synthesis/transformation.cpp ] - [ compile synthesis/mem_func_ptr_cv1.cpp ] - [ compile synthesis/mem_func_ptr_cv2.cpp ] - [ compile synthesis/mem_func_ptr_cv_ptr_to_this.cpp ] - [ compile synthesis/variadic_function_synthesis.cpp ] - # [ compile synthesis/cv_function_synthesis.cpp ] - - # Reconfiguration - - [ compile reconfiguration/preprocessing_mode.cpp ] - [ compile reconfiguration/partial_arity_preprocessing.cpp ] - [ compile reconfiguration/cc_preprocessing.cpp ] - - # Custom calling conventions - - [ compile custom_ccs/nonmember_ccs.cpp ] - [ compile custom_ccs/nonmember_ccs_exact.cpp ] - [ compile custom_ccs/member_ccs.cpp ] - [ compile custom_ccs/member_ccs_exact.cpp ] - - # Code from the examples - - [ compile ../example/interpreter_example.cpp ] - [ compile ../example/result_of_example.cpp ] - [ compile ../example/interface_example.cpp ] - [ compile ../example/fast_mem_fn_example.cpp - # needed for Boost.PP file iteration with some compilers - : ../example - ] - [ compile ../example/macro_type_args_example.cpp ] - ; -} - - diff --git a/test/classification/is_callable_builtin.cpp b/test/classification/is_callable_builtin.cpp deleted file mode 100644 index d65f6f3..0000000 --- a/test/classification/is_callable_builtin.cpp +++ /dev/null @@ -1,86 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -typedef void func(); -typedef void (*func_ptr)(); -typedef void (&func_ref)(); -class C; -typedef void (C::*mem_func_ptr)(); -typedef void (C::*c_mem_func_ptr)() const; -typedef void (C::*v_mem_func_ptr)() volatile; -typedef void (C::*cv_mem_func_ptr)() const volatile; - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< func > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< func_ref > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< c_mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< v_mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< cv_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< mem_func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< C > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< int > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< int* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< int** > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< int& > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< int[] > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< int[1] > -)); - diff --git a/test/classification/is_cv_function.cpp b/test/classification/is_cv_function.cpp deleted file mode 100644 index 176300c..0000000 --- a/test/classification/is_cv_function.cpp +++ /dev/null @@ -1,142 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -template -void test_non_cv(T C::*) -{ - BOOST_MPL_ASSERT(( - ft::is_function - )); - - BOOST_MPL_ASSERT(( - ft::is_function - )); - - BOOST_MPL_ASSERT(( - ft::is_function > - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function > - )); -} - -template -void test_c_non_v(T C::*) -{ - BOOST_MPL_ASSERT(( - ft::is_function - )); - - BOOST_MPL_ASSERT(( - ft::is_function - )); - - BOOST_MPL_ASSERT(( - ft::is_function > - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function > - )); -} - -template -void test_v_non_c(T C::*) -{ - BOOST_MPL_ASSERT(( - ft::is_function - )); - - BOOST_MPL_ASSERT(( - ft::is_function - )); - - BOOST_MPL_ASSERT(( - ft::is_function > - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function > - )); -} - -template -void test_cv(T C::*) -{ - BOOST_MPL_ASSERT(( - ft::is_function - )); - - BOOST_MPL_ASSERT(( - ft::is_function - )); - - BOOST_MPL_ASSERT(( - ft::is_function > - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function - )); - - BOOST_MPL_ASSERT_NOT(( - ft::is_function > - )); -} - - -struct C -{ - void non_cv(int) { } - void c_non_v(int) const { } - void v_non_c(int) volatile { } - void cv(int) const volatile { } -}; - -void instanitate() -{ - test_non_cv(& C::non_cv); - test_c_non_v(& C::c_non_v); - test_v_non_c(& C::v_non_c); - test_cv(& C::cv); -} - diff --git a/test/classification/is_cv_mem_func_ptr.cpp b/test/classification/is_cv_mem_func_ptr.cpp deleted file mode 100644 index 0b75c43..0000000 --- a/test/classification/is_cv_mem_func_ptr.cpp +++ /dev/null @@ -1,150 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -class C; -typedef void (C::*mem_func_ptr)(); -typedef void (C::*c_mem_func_ptr)() const; -typedef void (C::*v_mem_func_ptr)() volatile; -typedef void (C::*cv_mem_func_ptr)() const volatile; - - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< mem_func_ptr, ft::non_const > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< mem_func_ptr, ft::non_volatile > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< mem_func_ptr, - ft::tag > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< mem_func_ptr, ft::const_qualified > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< mem_func_ptr, ft::volatile_qualified > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< mem_func_ptr, - ft::tag > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< mem_func_ptr, - ft::tag > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< mem_func_ptr, - ft::tag > -)); - -// - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< c_mem_func_ptr, ft::const_qualified > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< c_mem_func_ptr, ft::non_volatile > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< c_mem_func_ptr, ft::non_const > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< c_mem_func_ptr, ft::volatile_qualified > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< c_mem_func_ptr, - ft::tag > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< c_mem_func_ptr, - ft::tag > -)); - -// - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< v_mem_func_ptr, ft::volatile_qualified > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< v_mem_func_ptr, ft::non_const > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< v_mem_func_ptr, ft::non_volatile > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< v_mem_func_ptr, ft::const_qualified > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< v_mem_func_ptr, - ft::tag > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< v_mem_func_ptr, - ft::tag > -)); - -// - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< cv_mem_func_ptr, ft::const_qualified > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< cv_mem_func_ptr, ft::volatile_qualified > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< cv_mem_func_ptr, ft::non_const > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< cv_mem_func_ptr, ft::non_volatile > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< cv_mem_func_ptr, - ft::tag > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< cv_mem_func_ptr, - ft::tag > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< cv_mem_func_ptr, - ft::tag > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< cv_mem_func_ptr, - ft::tag > -)); - diff --git a/test/classification/is_cv_pointer.cpp b/test/classification/is_cv_pointer.cpp deleted file mode 100644 index 383052e..0000000 --- a/test/classification/is_cv_pointer.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include - -namespace ft = boost::function_types; - -typedef void(* const func_c_ptr)(); -typedef void(* volatile func_v_ptr)(); -typedef void(* const volatile func_cv_ptr)(); -class C; -typedef void(C::* const mem_func_c_ptr)(); -typedef void(C::* volatile mem_func_v_ptr)(); -typedef void(C::* const volatile mem_func_cv_ptr)(); - -// note: the pointer has cv-qualifiers, not the function - non_cv tag must match - -BOOST_MPL_ASSERT(( - ft::is_function_pointer< func_c_ptr, ft::non_cv > -)); - -BOOST_MPL_ASSERT(( - ft::is_function_pointer< func_v_ptr, ft::non_cv > -)); - -BOOST_MPL_ASSERT(( - ft::is_function_pointer< func_cv_ptr, ft::non_cv > -)); - - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< mem_func_c_ptr, ft::non_cv > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< mem_func_v_ptr, ft::non_cv > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< mem_func_cv_ptr, ft::non_cv > -)); - - diff --git a/test/classification/is_function.cpp b/test/classification/is_function.cpp deleted file mode 100644 index 9c6a357..0000000 --- a/test/classification/is_function.cpp +++ /dev/null @@ -1,87 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -typedef void func(); -typedef void (*func_ptr)(); -typedef void (&func_ref)(); -class C; -typedef void (C::*mem_func_ptr)(); -typedef void (C::*c_mem_func_ptr)() const; -typedef void (C::*v_mem_func_ptr)() volatile; -typedef void (C::*cv_mem_func_ptr)() const volatile; - - -BOOST_MPL_ASSERT(( - ft::is_function< func > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< func_ref > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< c_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< v_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< cv_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< mem_func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< C > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< int > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< int* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< int** > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< int& > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< int[] > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function< int[1] > -)); - diff --git a/test/classification/is_function_pointer.cpp b/test/classification/is_function_pointer.cpp deleted file mode 100644 index 54ef29f..0000000 --- a/test/classification/is_function_pointer.cpp +++ /dev/null @@ -1,87 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -typedef void func(); -typedef void (*func_ptr)(); -typedef void (&func_ref)(); -class C; -typedef void (C::*mem_func_ptr)(); -typedef void (C::*c_mem_func_ptr)() const; -typedef void (C::*v_mem_func_ptr)() volatile; -typedef void (C::*cv_mem_func_ptr)() const volatile; - - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< func > -)); - -BOOST_MPL_ASSERT(( - ft::is_function_pointer< func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< func_ref > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< c_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< v_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< cv_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< mem_func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< C > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< int > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< int* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< int** > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< int& > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< int[] > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_pointer< int[1] > -)); - diff --git a/test/classification/is_function_reference.cpp b/test/classification/is_function_reference.cpp deleted file mode 100644 index 2f8f006..0000000 --- a/test/classification/is_function_reference.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -typedef void func(); -typedef void (*func_ptr)(); -typedef void (&func_ref)(); -class C; -typedef void (C::*mem_func_ptr)(); -typedef void (C::*c_mem_func_ptr)() const; -typedef void (C::*v_mem_func_ptr)() volatile; -typedef void (C::*cv_mem_func_ptr)() const volatile; - - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< func > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_function_reference< func_ref > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< c_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< v_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< cv_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< mem_func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< C > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< int > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< int* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< int** > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< int& > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< int[] > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_function_reference< int[1] > -)); - - diff --git a/test/classification/is_member_function_pointer.cpp b/test/classification/is_member_function_pointer.cpp deleted file mode 100644 index 0548c37..0000000 --- a/test/classification/is_member_function_pointer.cpp +++ /dev/null @@ -1,96 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -typedef void func(); -typedef void (*func_ptr)(); -typedef void (&func_ref)(); -class C; -typedef void (C::*mem_func_ptr)(); -typedef void (C::*c_mem_func_ptr)() const; -typedef void (C::*v_mem_func_ptr)() volatile; -typedef void (C::*cv_mem_func_ptr)() const volatile; -typedef int C::*mem_ptr; - - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< func > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< func_ref > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< c_mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< v_mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_function_pointer< cv_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< mem_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< mem_func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< mem_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< C > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< int > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< int* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< int** > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< int& > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< int[] > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_function_pointer< int[1] > -)); - diff --git a/test/classification/is_member_object_pointer.cpp b/test/classification/is_member_object_pointer.cpp deleted file mode 100644 index 8408327..0000000 --- a/test/classification/is_member_object_pointer.cpp +++ /dev/null @@ -1,95 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -typedef void func(); -typedef void (*func_ptr)(); -typedef void (&func_ref)(); -class C; -typedef void (C::*mem_func_ptr)(); -typedef void (C::*c_mem_func_ptr)() const; -typedef void (C::*v_mem_func_ptr)() volatile; -typedef void (C::*cv_mem_func_ptr)() const volatile; -typedef int C::*mem_ptr; - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< func > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< func_ref > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< c_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< v_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< cv_mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_object_pointer< mem_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< mem_func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< mem_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< C > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< int > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< int* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< int** > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< int& > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< int[] > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_object_pointer< int[1] > -)); - diff --git a/test/classification/is_member_pointer.cpp b/test/classification/is_member_pointer.cpp deleted file mode 100644 index 1139027..0000000 --- a/test/classification/is_member_pointer.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -typedef void func(); -typedef void (*func_ptr)(); -typedef void (&func_ref)(); -class C; -typedef void (C::*mem_func_ptr)(); -typedef void (C::*c_mem_func_ptr)() const; -typedef void (C::*v_mem_func_ptr)() volatile; -typedef void (C::*cv_mem_func_ptr)() const volatile; -typedef int C::*mem_ptr; - - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< func > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< func_ref > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_pointer< mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_pointer< c_mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_pointer< v_mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_pointer< cv_mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_member_pointer< mem_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< mem_func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< mem_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< C > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< int > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< int* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< int** > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_member_pointer< int& > -)); - diff --git a/test/classification/is_nonmember_callable_builtin.cpp b/test/classification/is_nonmember_callable_builtin.cpp deleted file mode 100644 index 902d6ee..0000000 --- a/test/classification/is_nonmember_callable_builtin.cpp +++ /dev/null @@ -1,87 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -typedef void func(); -typedef void (*func_ptr)(); -typedef void (&func_ref)(); -class C; -typedef void (C::*mem_func_ptr)(); -typedef void (C::*c_mem_func_ptr)() const; -typedef void (C::*v_mem_func_ptr)() volatile; -typedef void (C::*cv_mem_func_ptr)() const volatile; - - -BOOST_MPL_ASSERT(( - ft::is_nonmember_callable_builtin< func > -)); - -BOOST_MPL_ASSERT(( - ft::is_nonmember_callable_builtin< func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_nonmember_callable_builtin< func_ref > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< c_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< v_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< cv_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< mem_func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< C > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< int > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< int* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< int** > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< int& > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< int[] > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_nonmember_callable_builtin< int[1] > -)); - diff --git a/test/classification/is_variadic.cpp b/test/classification/is_variadic.cpp deleted file mode 100644 index 964ea8c..0000000 --- a/test/classification/is_variadic.cpp +++ /dev/null @@ -1,143 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -namespace ft = boost::function_types; - -typedef void func(...); -typedef void nv_func(); -typedef void (*func_ptr)(...); -typedef void (*nv_func_ptr)(); -typedef void (&func_ref)(...); -typedef void (&nv_func_ref)(); -class C; -typedef void (C::*mem_func_ptr)(...); -typedef void (C::*nv_mem_func_ptr)(); -typedef void (C::*c_mem_func_ptr)(...) const; -typedef void (C::*v_mem_func_ptr)(...) volatile; -typedef void (C::*cv_mem_func_ptr)(...) const volatile; -typedef int C::* mem_ptr; - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< func > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< func, ft::variadic > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< func, ft::non_variadic > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< nv_func > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< nv_func, ft::variadic > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< nv_func, ft::non_variadic > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< func_ptr, ft::variadic> -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< func_ptr, ft::non_variadic > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< nv_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< nv_func_ptr, ft::variadic> -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< nv_func_ptr, ft::non_variadic > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< func_ref > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< mem_func_ptr, ft::variadic > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< mem_func_ptr, ft::non_variadic > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< nv_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< nv_mem_func_ptr, ft::variadic > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< nv_mem_func_ptr, ft::non_variadic > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< c_mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< v_mem_func_ptr > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< cv_mem_func_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< mem_func_ptr* > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< C, ft::variadic > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< C, ft::non_variadic > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< mem_ptr > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< mem_ptr, ft::variadic > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< mem_ptr, ft::non_variadic > -)); - diff --git a/test/custom_ccs/member_ccs.cpp b/test/custom_ccs/member_ccs.cpp deleted file mode 100644 index 727b38b..0000000 --- a/test/custom_ccs/member_ccs.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS - -#include -#include -#include -#include - -#ifndef BOOST_FT_CC_STDCALL -# error "test not supported with this compiler" -#endif - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; - -typedef ft::stdcall_cc cc; - -class C; - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< - ft::member_function_pointer, cc>::type - > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< - ft::member_function_pointer, cc>::type - > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< - ft::member_function_pointer, cc>::type - > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< - ft::member_function_pointer, cc>::type - > -)); - diff --git a/test/custom_ccs/member_ccs_exact.cpp b/test/custom_ccs/member_ccs_exact.cpp deleted file mode 100644 index 2decf14..0000000 --- a/test/custom_ccs/member_ccs_exact.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS - -#include -#include -#include -#include - -#ifndef BOOST_FT_CC_STDCALL -# error "test not supported with this compiler" -#endif - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; - -typedef ft::stdcall_cc cc; -typedef ft::default_cc dc; - -class C; - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< ft::member_function_pointer, cc>::type, cc > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< ft::member_function_pointer, cc>::type, cc > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< ft::member_function_pointer, cc>::type, cc > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< ft::member_function_pointer, cc>::type, cc > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< ft::member_function_pointer >::type, dc > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< ft::member_function_pointer, cc>::type, dc > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< ft::member_function_pointer, cc>::type, dc > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< ft::member_function_pointer, cc>::type, dc > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< ft::member_function_pointer, cc>::type, dc > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< ft::member_function_pointer >::type, cc > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< ft::member_function_pointer, cc>::type, dc > -)); - diff --git a/test/custom_ccs/nonmember_ccs.cpp b/test/custom_ccs/nonmember_ccs.cpp deleted file mode 100644 index 98bf3d5..0000000 --- a/test/custom_ccs/nonmember_ccs.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS - -#include -#include -#include -#include -#include -#include - -#ifndef BOOST_FT_CC_STDCALL -# error "test not supported with this compiler" -#endif - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; - -typedef ft::stdcall_cc cc; - - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< - ft::function_type, cc>::type - > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< - ft::function_pointer, cc>::type - > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< - ft::function_reference, cc>::type - > -)); - diff --git a/test/custom_ccs/nonmember_ccs_exact.cpp b/test/custom_ccs/nonmember_ccs_exact.cpp deleted file mode 100644 index 31f73c0..0000000 --- a/test/custom_ccs/nonmember_ccs_exact.cpp +++ /dev/null @@ -1,62 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS - -#include -#include -#include -#include -#include -#include - -#ifndef BOOST_FT_CC_STDCALL -# error "test not supported with this compiler" -#endif - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; - -typedef ft::stdcall_cc cc; -typedef ft::default_cc dc; - - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< ft::function_type,cc>::type, cc > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< ft::function_pointer,cc>::type, cc > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< ft::function_reference,cc>::type, cc > -)); - -BOOST_MPL_ASSERT(( - ft::is_callable_builtin< ft::function_pointer >::type, dc > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< ft::function_type, cc>::type, dc > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< ft::function_pointer,cc>::type, dc > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< ft::function_reference,cc>::type, dc > -)); - -BOOST_MPL_ASSERT_NOT(( - ft::is_callable_builtin< ft::function_pointer >::type, cc > -)); - - - diff --git a/test/decomposition/class_type_transform.cpp b/test/decomposition/class_type_transform.cpp deleted file mode 100644 index f007a40..0000000 --- a/test/decomposition/class_type_transform.cpp +++ /dev/null @@ -1,62 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -#include -#include -#include -#include - -#include -#include - -using namespace boost; -namespace ft = function_types; -using boost::mpl::placeholders::_; - -class C; -typedef C (C::*mem_func_ptr)(); -class X; - -BOOST_MPL_ASSERT(( - is_same< mpl::at_c< - ft::components > - ,1 >::type, C* > -)); -BOOST_MPL_ASSERT(( - is_same< mpl::at_c< - ft::components > > - ,1 >::type, C** > -)); -BOOST_MPL_ASSERT(( - is_same< mpl::at_c< - ft::components > - ,1 >::type, X > -)); - -BOOST_MPL_ASSERT(( - is_same< mpl::at_c< - ft::parameter_types > - ,0 >::type, C* > -)); -BOOST_MPL_ASSERT(( - is_same< mpl::at_c< - ft::parameter_types > > - ,0 >::type, C** > -)); -BOOST_MPL_ASSERT(( - is_same< mpl::at_c< - ft::parameter_types > - ,0 >::type, X > -)); - - - - diff --git a/test/decomposition/components.cpp b/test/decomposition/components.cpp deleted file mode 100644 index 60cebde..0000000 --- a/test/decomposition/components.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include - -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; - -class C; -typedef C func(); -typedef C (*func_ptr)(int); -typedef C (&func_ref)(int,int); -typedef C (C::*mem_func_ptr)(); -typedef C (C::*c_mem_func_ptr)(int) const; -typedef C (C::*v_mem_func_ptr)(int,int) volatile; -typedef C (C::*cv_mem_func_ptr)(int,int,int) const volatile; -typedef int C::* mem_ptr; - -BOOST_MPL_ASSERT(( - mpl::equal< ft::components::types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::components::types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::components::types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::components::types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::components::types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::components::types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::components::types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::components::types, mpl::vector > -)); - diff --git a/test/decomposition/components_seq.cpp b/test/decomposition/components_seq.cpp deleted file mode 100644 index ad5f590..0000000 --- a/test/decomposition/components_seq.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; -using boost::is_same; - -class C; -typedef C (C::* mem_func_ptr)(int); -typedef ft::components c; - - -// front -BOOST_MPL_ASSERT(( is_same< ::boost::mpl::front::type, C > )); - -// back -BOOST_MPL_ASSERT(( is_same< ::boost::mpl::back::type, int > )); - -// at -BOOST_MPL_ASSERT(( is_same< ::boost::mpl::at_c::type, C > )); -BOOST_MPL_ASSERT(( is_same< ::boost::mpl::at_c::type, C & > )); -BOOST_MPL_ASSERT(( is_same< ::boost::mpl::at_c::type, int > )); - -// begin/end -BOOST_MPL_ASSERT(( mpl::equal< c, mpl::vector > )); - - -// clear -BOOST_MPL_ASSERT(( mpl::equal< mpl::clear, mpl::vector<> > )); - -// push_front -BOOST_MPL_ASSERT(( mpl::equal< mpl::push_front::type, mpl::vector > )); - -// pop_front -BOOST_MPL_ASSERT(( mpl::equal< mpl::pop_front::type, mpl::vector > )); - -// push_back -BOOST_MPL_ASSERT(( mpl::equal< mpl::push_back::type, mpl::vector > )); - -// pop_back -BOOST_MPL_ASSERT(( mpl::equal< mpl::pop_back::type, mpl::vector > )); - - -// size -BOOST_MPL_ASSERT_RELATION( ::boost::mpl::size::value, ==, 3 ); - -// empty -BOOST_MPL_ASSERT_NOT(( mpl::empty )); -BOOST_MPL_ASSERT(( mpl::empty< mpl::clear > )); - diff --git a/test/decomposition/function_arity.cpp b/test/decomposition/function_arity.cpp deleted file mode 100644 index 219c2c6..0000000 --- a/test/decomposition/function_arity.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include - -#include - -class C; -typedef C func(); -typedef C (*func_ptr)(int); -typedef C (&func_ref)(int,int); -typedef C (C::*mem_func_ptr)(); -typedef C (C::*c_mem_func_ptr)(int) const; -typedef C (C::*v_mem_func_ptr)(int,int) volatile; -typedef C (C::*cv_mem_func_ptr)(int,int,int) const volatile; -typedef int C::* mem_ptr; - -BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 0 ); -BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 1 ); -BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 2 ); -BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 1 ); -BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 2 ); -BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 3 ); -BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 4 ); -BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 1 ); - diff --git a/test/decomposition/function_arity_fail.cpp b/test/decomposition/function_arity_fail.cpp deleted file mode 100644 index 39a7c74..0000000 --- a/test/decomposition/function_arity_fail.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include - - -namespace ft = boost::function_types; - -class C; - -typedef ft::function_arity::type error_1; -typedef ft::function_arity::type error_2; -typedef ft::function_arity::type error_3; - diff --git a/test/decomposition/parameter_types.cpp b/test/decomposition/parameter_types.cpp deleted file mode 100644 index 5feb1a8..0000000 --- a/test/decomposition/parameter_types.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include - -#include - - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; - -class C; -typedef C func(C); -typedef C (*func_ptr)(C,int); -typedef C (&func_ref)(); -typedef C (C::*mem_func_ptr)(C,int); -typedef C (C::*c_mem_func_ptr)(C,C) const; -typedef C (C::*v_mem_func_ptr)(C) volatile; -typedef C (C::*cv_mem_func_ptr)() const volatile; -typedef C C::*mem_ptr; - -BOOST_MPL_ASSERT(( - mpl::equal< ft::parameter_types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::parameter_types::type, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::parameter_types, mpl::vector<> > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::parameter_types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::parameter_types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::parameter_types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::parameter_types, mpl::vector > -)); - -BOOST_MPL_ASSERT(( - mpl::equal< ft::parameter_types, mpl::vector > -)); diff --git a/test/decomposition/parameter_types_fail.cpp b/test/decomposition/parameter_types_fail.cpp deleted file mode 100644 index d23e891..0000000 --- a/test/decomposition/parameter_types_fail.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include - - -namespace ft = boost::function_types; - -class C; - -typedef ft::parameter_types::type error_1; -typedef ft::parameter_types::type error_2; -typedef ft::parameter_types::type error_3; - diff --git a/test/decomposition/result_type.cpp b/test/decomposition/result_type.cpp deleted file mode 100644 index 8f1157d..0000000 --- a/test/decomposition/result_type.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -#include - - -namespace ft = boost::function_types; - -class C; -typedef C func(); -typedef C (*func_ptr)(); -typedef C (&func_ref)(); -typedef C (C::*mem_func_ptr)(); -typedef C (C::*c_mem_func_ptr)() const; -typedef C (C::*v_mem_func_ptr)() volatile; -typedef C (C::*cv_mem_func_ptr)() const volatile; -typedef int C::* mem_ptr; -typedef int const C::* c_mem_ptr; - -BOOST_MPL_ASSERT(( - boost::is_same::type,C> -)); - -BOOST_MPL_ASSERT(( - boost::is_same::type,C> -)); - -BOOST_MPL_ASSERT(( - boost::is_same::type,C> -)); - -BOOST_MPL_ASSERT(( - boost::is_same::type,C> -)); - -BOOST_MPL_ASSERT(( - boost::is_same::type,C> -)); - -BOOST_MPL_ASSERT(( - boost::is_same::type,C> -)); - -BOOST_MPL_ASSERT(( - boost::is_same::type,C> -)); - -BOOST_MPL_ASSERT(( - boost::is_same::type,int&> -)); - -BOOST_MPL_ASSERT(( - boost::is_same::type,int const&> -)); - diff --git a/test/decomposition/result_type_fail.cpp b/test/decomposition/result_type_fail.cpp deleted file mode 100644 index c701e57..0000000 --- a/test/decomposition/result_type_fail.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include - - -namespace ft = boost::function_types; - -class C; - -typedef ft::result_type::type error_1; -typedef ft::result_type::type error_2; -typedef ft::result_type::type error_3; - diff --git a/test/reconfiguration/cc_preprocessing.cpp b/test/reconfiguration/cc_preprocessing.cpp deleted file mode 100644 index 889645d..0000000 --- a/test/reconfiguration/cc_preprocessing.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#define BOOST_FT_CC_PREPROCESSING 1 -#include "simple_test.hpp" - diff --git a/test/reconfiguration/partial_arity_preprocessing.cpp b/test/reconfiguration/partial_arity_preprocessing.cpp deleted file mode 100644 index bd58cf9..0000000 --- a/test/reconfiguration/partial_arity_preprocessing.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#define BOOST_FT_MAX_ARITY 19 -#include "simple_test.hpp" - diff --git a/test/reconfiguration/preprocessing_mode.cpp b/test/reconfiguration/preprocessing_mode.cpp deleted file mode 100644 index d6601c4..0000000 --- a/test/reconfiguration/preprocessing_mode.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#define BOOST_FT_PREPROCESSING_MODE 1 -#include "simple_test.hpp" - diff --git a/test/reconfiguration/simple_test.hpp b/test/reconfiguration/simple_test.hpp deleted file mode 100644 index 5b62a0b..0000000 --- a/test/reconfiguration/simple_test.hpp +++ /dev/null @@ -1,51 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include -#include - -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; - -class C; -typedef void func(C &); -typedef int (C::* mem_func_ptr)(int); - -typedef ft::components func_components; -typedef ft::components mfp_components; - -BOOST_MPL_ASSERT(( - mpl::equal< func_components::types, mpl::vector > -)); -BOOST_MPL_ASSERT_RELATION( - ::func_components::function_arity::value, ==, 1 -); - -BOOST_MPL_ASSERT(( - boost::is_same< ft::function_type< mpl::vector >::type, func > -)); - - -BOOST_MPL_ASSERT(( - mpl::equal< mfp_components::types, mpl::vector > -)); -BOOST_MPL_ASSERT_RELATION( - ::mfp_components::function_arity::value, ==, 2 -); - -BOOST_MPL_ASSERT(( - boost::is_same< ft::member_function_pointer< mpl::vector >::type, mem_func_ptr > -)); - - diff --git a/test/synthesis/cv_function_synthesis.cpp b/test/synthesis/cv_function_synthesis.cpp deleted file mode 100644 index b80e854..0000000 --- a/test/synthesis/cv_function_synthesis.cpp +++ /dev/null @@ -1,249 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; - -template -void test_non_cv(T C::*) -{ - BOOST_MPL_ASSERT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT(( boost::is_same< - ft::function_type< mpl::vector, ft::non_const >::type - , T - >)); - - BOOST_MPL_ASSERT(( boost::is_same< - ft::function_type< mpl::vector, ft::non_volatile >::type - , T - >)); - - BOOST_MPL_ASSERT(( boost::is_same< - ft::function_type< mpl::vector >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, ft::const_qualified >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( - boost::is_same< - ft::function_type< mpl::vector, ft::volatile_qualified >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); -} - -template -void test_c_non_v(T C::*) -{ - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, ft::non_const >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, ft::non_volatile >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector >::type - , T - >)); - - BOOST_MPL_ASSERT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT(( boost::is_same< - ft::function_type< mpl::vector, ft::const_qualified >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( - boost::is_same< - ft::function_type< mpl::vector, ft::volatile_qualified >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); -} - -template -void test_v_non_c(T C::*) -{ - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, ft::non_const >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, ft::non_volatile >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, ft::const_qualified >::type - , T - >)); - - BOOST_MPL_ASSERT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT(( - boost::is_same< - ft::function_type< mpl::vector, ft::volatile_qualified >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); -} - -template -void test_cv(T C::*) -{ - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, ft::non_const >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, ft::non_volatile >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, ft::const_qualified >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); - - BOOST_MPL_ASSERT_NOT(( - boost::is_same< - ft::function_type< mpl::vector, ft::volatile_qualified >::type - , T - >)); - - BOOST_MPL_ASSERT(( boost::is_same< - ft::function_type< mpl::vector, - ft::tag >::type - , T - >)); -} - - -struct C -{ - void non_cv(int) { } - void c_non_v(int) const { } - void v_non_c(int) volatile { } - void cv(int) const volatile { } -}; - -void instanitate() -{ - test_non_cv(& C::non_cv); - test_c_non_v(& C::c_non_v); - test_v_non_c(& C::v_non_c); - test_cv(& C::cv); -} - diff --git a/test/synthesis/function_pointer.cpp b/test/synthesis/function_pointer.cpp deleted file mode 100644 index 1150934..0000000 --- a/test/synthesis/function_pointer.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; - -using boost::is_same; - -typedef int (* expected)(int,int); - -BOOST_MPL_ASSERT(( - is_same< ft::function_pointer< mpl::vector >::type, expected > -)); - diff --git a/test/synthesis/function_reference.cpp b/test/synthesis/function_reference.cpp deleted file mode 100644 index 92fa714..0000000 --- a/test/synthesis/function_reference.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; - -using boost::is_same; - -typedef int (& expected)(int); - -BOOST_MPL_ASSERT(( - is_same< ft::function_reference< mpl::vector >::type, expected > -)); - diff --git a/test/synthesis/function_type.cpp b/test/synthesis/function_type.cpp deleted file mode 100644 index bb08ce7..0000000 --- a/test/synthesis/function_type.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; -using boost::is_same; - -typedef int expected(int,int); - -BOOST_MPL_ASSERT(( - is_same< ft::function_type< mpl::vector >::type, expected > -)); - diff --git a/test/synthesis/mem_func_ptr_cv1.cpp b/test/synthesis/mem_func_ptr_cv1.cpp deleted file mode 100644 index b1f70be..0000000 --- a/test/synthesis/mem_func_ptr_cv1.cpp +++ /dev/null @@ -1,94 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; -using boost::is_same; - -class C; - -typedef int (C::* expected1)(int); -typedef int (C::* expected2)(int) const; -typedef int (C::* expected3)(int) volatile; -typedef int (C::* expected4)(int) const volatile; - -// implicitly specified cv qualification - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector >::type - , expected1 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector >::type - , expected2 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< - mpl::vector >::type - , expected3 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< - mpl::vector >::type - , expected4 > -)); - -// implicit & explicit/overrides - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< - mpl::vector - , ft::tag >::type - , expected1 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected2 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected3 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected4 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected4 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector - , ft::const_qualified >::type - , expected4 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector - , ft::volatile_qualified >::type - , expected4 > -)); - - diff --git a/test/synthesis/mem_func_ptr_cv2.cpp b/test/synthesis/mem_func_ptr_cv2.cpp deleted file mode 100644 index 007efa0..0000000 --- a/test/synthesis/mem_func_ptr_cv2.cpp +++ /dev/null @@ -1,94 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; -using boost::is_same; - -class C; - -typedef int (C::* expected1)(int); -typedef int (C::* expected2)(int) const; -typedef int (C::* expected3)(int) volatile; -typedef int (C::* expected4)(int) const volatile; - -// implicitly specified cv qualification - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector >::type - , expected1 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector >::type - , expected2 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< - mpl::vector >::type - , expected3 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< - mpl::vector >::type - , expected4 > -)); - -// implicit & explicit/overrides - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< - mpl::vector - , ft::tag >::type - , expected1 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected2 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected3 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected4 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected4 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector - , ft::const_qualified >::type - , expected4 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector - , ft::volatile_qualified >::type - , expected4 > -)); - - diff --git a/test/synthesis/mem_func_ptr_cv_ptr_to_this.cpp b/test/synthesis/mem_func_ptr_cv_ptr_to_this.cpp deleted file mode 100644 index 1b6d906..0000000 --- a/test/synthesis/mem_func_ptr_cv_ptr_to_this.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; -using boost::is_same; - -class C; -typedef int (C::* expected)(); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector >::type - , expected > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector >::type - , expected > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector >::type - , expected > -)); - - - diff --git a/test/synthesis/member_function_pointer.cpp b/test/synthesis/member_function_pointer.cpp deleted file mode 100644 index 6234c47..0000000 --- a/test/synthesis/member_function_pointer.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; -using boost::is_same; - -class C; - -typedef int (C::* expected1)(int); -typedef int (C::* expected2)(int) const; -typedef int (C::* expected3)(int) volatile; -typedef int (C::* expected4)(int) const volatile; - - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector >::type - , expected1 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected1 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector - , ft::const_qualified >::type - , expected2 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected2 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector - , ft::volatile_qualified >::type - , expected3 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected3 > -)); - -BOOST_MPL_ASSERT(( - is_same< ft::member_function_pointer< mpl::vector, - ft::tag >::type - , expected4 > -)); - diff --git a/test/synthesis/member_object_pointer.cpp b/test/synthesis/member_object_pointer.cpp deleted file mode 100644 index 65af741..0000000 --- a/test/synthesis/member_object_pointer.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; -using boost::is_same; - -class C; - -typedef int C::* expected; - - -BOOST_MPL_ASSERT(( - is_same< ft::member_object_pointer< mpl::vector >::type - , expected > -)); - diff --git a/test/synthesis/transformation.cpp b/test/synthesis/transformation.cpp deleted file mode 100644 index 3885647..0000000 --- a/test/synthesis/transformation.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include - -#include -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; -using boost::is_same; - -class C; - -typedef C func1(C &); -typedef C (*func_ptr1)(C &); -typedef C (&func_ref1)(C &); -typedef C (C::*mem_func_ptr1)(); - -BOOST_MPL_ASSERT(( is_same< func1, ft::function_type::type > )); -BOOST_MPL_ASSERT(( is_same< func1, ft::function_type::type > )); -BOOST_MPL_ASSERT(( is_same< func1, ft::function_type::type > )); -BOOST_MPL_ASSERT(( is_same< func1, ft::function_type::type > )); - -BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer::type > )); - -BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference::type > )); -BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference::type > )); -BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference::type > )); -BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference::type > )); - -BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer::type > )); - - -typedef C func2(C const &); -typedef C (*func_ptr2)(C const &); -typedef C (&func_ref2)(C const &); -typedef C (C::*mem_func_ptr2)() const; - -BOOST_MPL_ASSERT(( is_same< func2, ft::function_type::type > )); -BOOST_MPL_ASSERT(( is_same< func2, ft::function_type::type > )); -BOOST_MPL_ASSERT(( is_same< func2, ft::function_type::type > )); -BOOST_MPL_ASSERT(( is_same< func2, ft::function_type::type > )); - -BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer::type > )); - -BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference::type > )); -BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference::type > )); -BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference::type > )); -BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference::type > )); - -BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer::type > )); -BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer::type > )); - - - diff --git a/test/synthesis/variadic_function_synthesis.cpp b/test/synthesis/variadic_function_synthesis.cpp deleted file mode 100644 index d35b319..0000000 --- a/test/synthesis/variadic_function_synthesis.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -// (C) Copyright Tobias Schwinger -// -// Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). - -//------------------------------------------------------------------------------ - -#include -#include -#include - -#include -#include -#include -#include - -namespace ft = boost::function_types; -namespace mpl = boost::mpl; -using boost::is_same; - -class C; -typedef int expected_v_1(...); -typedef int expected_nv_1(); -typedef int (C::*expected_v_2)(...); -typedef int (C::*expected_nv_2)(); - -BOOST_MPL_ASSERT(( is_same< - ft::function_type, ft::variadic>::type, expected_v_1 -> )); - -BOOST_MPL_ASSERT(( is_same< - ft::function_type, ft::non_variadic>::type, expected_nv_1 -> )); - -BOOST_MPL_ASSERT(( is_same< - ft::function_pointer, ft::variadic>::type, expected_v_1 * -> )); - -BOOST_MPL_ASSERT(( is_same< - ft::function_pointer, ft::non_variadic>::type - , expected_nv_1 * -> )); - -BOOST_MPL_ASSERT(( is_same< - ft::function_reference, ft::variadic>::type, expected_v_1 & -> )); - -BOOST_MPL_ASSERT(( is_same< - ft::function_reference, ft::non_variadic>::type - , expected_nv_1 & -> )); - -BOOST_MPL_ASSERT(( is_same< - ft::member_function_pointer, ft::variadic>::type - , expected_v_2 -> )); - -BOOST_MPL_ASSERT(( is_same< - ft::member_function_pointer, ft::non_variadic>::type - , expected_nv_2 -> )); - From 291304b7041772b814d5bbca95a070f07ea2a4ff Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 18:38:02 +0000 Subject: [PATCH 02/15] Full merge from trunk at revision 41356 of entire boost-root tree. [SVN r41370] --- build/Jamfile | 30 + build/preprocess_arity_loops.cpp | 88 ++ build/preprocess_cc_names.cpp | 27 + build/preprocess_encoding.cpp | 45 + build/timestamps/arity_loops | 1 + build/timestamps/cc_names | 2 + build/timestamps/encoding | 1 + doc/Jamfile | 22 + doc/function_types.qbk | 1104 +++++++++++++++++ .../boost_functiontypes/about_tag_types.html | 94 ++ .../boost_functiontypes/acknowledgements.html | 85 ++ .../boost_functiontypes/introduction.html | 94 ++ doc/html/boost_functiontypes/rationale.html | 149 +++ doc/html/boost_functiontypes/reference.html | 49 + .../reference/classification.html | 407 ++++++ .../reference/decomposition.html | 233 ++++ .../boost_functiontypes/reference/macros.html | 246 ++++ .../reference/synthesis.html | 230 ++++ .../reference/tag_types.html | 320 +++++ doc/html/boost_functiontypes/use_cases.html | 175 +++ doc/html/boostbook.css | 528 ++++++++ doc/html/index.html | 55 + example/Jamfile | 20 + example/detail/param_type.hpp | 71 ++ example/fast_mem_fn.hpp | 248 ++++ example/fast_mem_fn_example.cpp | 118 ++ example/interface.hpp | 361 ++++++ example/interface_example.cpp | 79 ++ example/interpreter.hpp | 188 +++ example/interpreter_example.cpp | 56 + example/macro_type_args.hpp | 73 ++ example/macro_type_args_example.cpp | 71 ++ example/result_of.hpp | 86 ++ example/result_of_example.cpp | 59 + index.html | 14 + test/Jamfile | 85 ++ test/classification/is_callable_builtin.cpp | 86 ++ test/classification/is_cv_function.cpp | 142 +++ test/classification/is_cv_mem_func_ptr.cpp | 150 +++ test/classification/is_cv_pointer.cpp | 50 + test/classification/is_function.cpp | 87 ++ test/classification/is_function_pointer.cpp | 87 ++ test/classification/is_function_reference.cpp | 88 ++ .../is_member_function_pointer.cpp | 96 ++ .../is_member_object_pointer.cpp | 95 ++ test/classification/is_member_pointer.cpp | 88 ++ .../is_nonmember_callable_builtin.cpp | 87 ++ test/classification/is_variadic.cpp | 143 +++ test/custom_ccs/member_ccs.cpp | 50 + test/custom_ccs/member_ccs_exact.cpp | 71 ++ test/custom_ccs/nonmember_ccs.cpp | 45 + test/custom_ccs/nonmember_ccs_exact.cpp | 62 + test/decomposition/class_type_transform.cpp | 62 + test/decomposition/components.cpp | 59 + test/decomposition/components_seq.cpp | 75 ++ test/decomposition/function_arity.cpp | 31 + test/decomposition/function_arity_fail.cpp | 19 + test/decomposition/parameter_types.cpp | 59 + test/decomposition/parameter_types_fail.cpp | 19 + test/decomposition/result_type.cpp | 63 + test/decomposition/result_type_fail.cpp | 19 + test/reconfiguration/cc_preprocessing.cpp | 11 + .../partial_arity_preprocessing.cpp | 11 + test/reconfiguration/preprocessing_mode.cpp | 11 + test/reconfiguration/simple_test.hpp | 51 + test/synthesis/cv_function_synthesis.cpp | 249 ++++ test/synthesis/function_pointer.cpp | 24 + test/synthesis/function_reference.cpp | 24 + test/synthesis/function_type.cpp | 23 + test/synthesis/mem_func_ptr_cv1.cpp | 94 ++ test/synthesis/mem_func_ptr_cv2.cpp | 94 ++ .../synthesis/mem_func_ptr_cv_ptr_to_this.cpp | 37 + test/synthesis/member_function_pointer.cpp | 66 + test/synthesis/member_object_pointer.cpp | 27 + test/synthesis/transformation.cpp | 75 ++ .../synthesis/variadic_function_synthesis.cpp | 63 + 76 files changed, 8207 insertions(+) create mode 100644 build/Jamfile create mode 100644 build/preprocess_arity_loops.cpp create mode 100644 build/preprocess_cc_names.cpp create mode 100644 build/preprocess_encoding.cpp create mode 100644 build/timestamps/arity_loops create mode 100644 build/timestamps/cc_names create mode 100644 build/timestamps/encoding create mode 100644 doc/Jamfile create mode 100644 doc/function_types.qbk create mode 100644 doc/html/boost_functiontypes/about_tag_types.html create mode 100644 doc/html/boost_functiontypes/acknowledgements.html create mode 100644 doc/html/boost_functiontypes/introduction.html create mode 100644 doc/html/boost_functiontypes/rationale.html create mode 100644 doc/html/boost_functiontypes/reference.html create mode 100644 doc/html/boost_functiontypes/reference/classification.html create mode 100644 doc/html/boost_functiontypes/reference/decomposition.html create mode 100644 doc/html/boost_functiontypes/reference/macros.html create mode 100644 doc/html/boost_functiontypes/reference/synthesis.html create mode 100644 doc/html/boost_functiontypes/reference/tag_types.html create mode 100644 doc/html/boost_functiontypes/use_cases.html create mode 100644 doc/html/boostbook.css create mode 100644 doc/html/index.html create mode 100644 example/Jamfile create mode 100644 example/detail/param_type.hpp create mode 100644 example/fast_mem_fn.hpp create mode 100644 example/fast_mem_fn_example.cpp create mode 100644 example/interface.hpp create mode 100644 example/interface_example.cpp create mode 100644 example/interpreter.hpp create mode 100644 example/interpreter_example.cpp create mode 100644 example/macro_type_args.hpp create mode 100644 example/macro_type_args_example.cpp create mode 100644 example/result_of.hpp create mode 100644 example/result_of_example.cpp create mode 100644 index.html create mode 100644 test/Jamfile create mode 100644 test/classification/is_callable_builtin.cpp create mode 100644 test/classification/is_cv_function.cpp create mode 100644 test/classification/is_cv_mem_func_ptr.cpp create mode 100644 test/classification/is_cv_pointer.cpp create mode 100644 test/classification/is_function.cpp create mode 100644 test/classification/is_function_pointer.cpp create mode 100644 test/classification/is_function_reference.cpp create mode 100644 test/classification/is_member_function_pointer.cpp create mode 100644 test/classification/is_member_object_pointer.cpp create mode 100644 test/classification/is_member_pointer.cpp create mode 100644 test/classification/is_nonmember_callable_builtin.cpp create mode 100644 test/classification/is_variadic.cpp create mode 100644 test/custom_ccs/member_ccs.cpp create mode 100644 test/custom_ccs/member_ccs_exact.cpp create mode 100644 test/custom_ccs/nonmember_ccs.cpp create mode 100644 test/custom_ccs/nonmember_ccs_exact.cpp create mode 100644 test/decomposition/class_type_transform.cpp create mode 100644 test/decomposition/components.cpp create mode 100644 test/decomposition/components_seq.cpp create mode 100644 test/decomposition/function_arity.cpp create mode 100644 test/decomposition/function_arity_fail.cpp create mode 100644 test/decomposition/parameter_types.cpp create mode 100644 test/decomposition/parameter_types_fail.cpp create mode 100644 test/decomposition/result_type.cpp create mode 100644 test/decomposition/result_type_fail.cpp create mode 100644 test/reconfiguration/cc_preprocessing.cpp create mode 100644 test/reconfiguration/partial_arity_preprocessing.cpp create mode 100644 test/reconfiguration/preprocessing_mode.cpp create mode 100644 test/reconfiguration/simple_test.hpp create mode 100644 test/synthesis/cv_function_synthesis.cpp create mode 100644 test/synthesis/function_pointer.cpp create mode 100644 test/synthesis/function_reference.cpp create mode 100644 test/synthesis/function_type.cpp create mode 100644 test/synthesis/mem_func_ptr_cv1.cpp create mode 100644 test/synthesis/mem_func_ptr_cv2.cpp create mode 100644 test/synthesis/mem_func_ptr_cv_ptr_to_this.cpp create mode 100644 test/synthesis/member_function_pointer.cpp create mode 100644 test/synthesis/member_object_pointer.cpp create mode 100644 test/synthesis/transformation.cpp create mode 100644 test/synthesis/variadic_function_synthesis.cpp diff --git a/build/Jamfile b/build/Jamfile new file mode 100644 index 0000000..ce5fb17 --- /dev/null +++ b/build/Jamfile @@ -0,0 +1,30 @@ + +# (C) Copyright Tobias Schwinger +# +# Use modification and distribution are subject to the boost Software License, +# Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). + +# Generates preprocessed files with wave. + +rule wave +{ + Depends $1 : $2 ; +} + +actions wave +{ + $(BOOST_ROOT)/dist/bin/wave -S$(BOOST_ROOT) $(>) -o $(<) +} + +make $(BOOST_ROOT)/libs/function_types/build/timestamps/arity_loops + : preprocess_arity_loops.cpp : wave + ; + +make $(BOOST_ROOT)/libs/function_types/build/timestamps/encoding + : preprocess_encoding.cpp : wave + ; + +make $(BOOST_ROOT)/libs/function_types/build/timestamps/cc_names + : preprocess_cc_names.cpp : wave + ; + diff --git a/build/preprocess_arity_loops.cpp b/build/preprocess_arity_loops.cpp new file mode 100644 index 0000000..a045e9f --- /dev/null +++ b/build/preprocess_arity_loops.cpp @@ -0,0 +1,88 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#if !defined(BOOST_FT_PREPROCESSING_MODE) + +# ifndef __WAVE__ +# error "Boost.Wave preprocessor required" +# endif + +# include +# include + +# if BOOST_PP_NIL // enable dependency scanning for dynamically included files +# include +# include +# include +# include +# endif + +# pragma wave option(line: 0, preserve: 2) +timestamp file +# pragma wave option(output: null) + +# define BOOST_FT_PREPROCESSING_MODE + +# define BOOST_FT_HEADER \ + BOOST_PP_SEQ_CAT((arity)(BOOST_FT_MAX_ARITY)(_)(BOOST_FT_mfp)).hpp + #define BOOST_FT_OUT_FILE \ + BOOST_PP_STRINGIZE(../../../BOOST_FT_al_path/BOOST_FT_HEADER) + +# define BOOST_FT_al_path boost/function_types/detail/components_impl +# include __FILE__ +# undef BOOST_FT_al_path + +# define BOOST_FT_al_path boost/function_types/detail/synthesize_impl +# include __FILE__ +# undef BOOST_FT_al_path + +# define BOOST_FT_al_path boost/function_types/detail/classifier_impl +# include __FILE__ +# undef BOOST_FT_al_path + +#elif !defined(BOOST_FT_mfp) + +# define BOOST_FT_mfp 0 +# include __FILE__ +# undef BOOST_FT_mfp + +# define BOOST_FT_mfp 1 +# include __FILE__ +# undef BOOST_FT_mfp + +#elif !defined(BOOST_FT_MAX_ARITY) + +# define BOOST_FT_FROM_ARITY 0 +# define BOOST_FT_MAX_ARITY 10 +# include __FILE__ + +# define BOOST_FT_FROM_ARITY 10 +# define BOOST_FT_MAX_ARITY 20 +# include __FILE__ + +# define BOOST_FT_FROM_ARITY 20 +# define BOOST_FT_MAX_ARITY 30 +# include __FILE__ + +# define BOOST_FT_FROM_ARITY 30 +# define BOOST_FT_MAX_ARITY 40 +# include __FILE__ + +# define BOOST_FT_FROM_ARITY 40 +# define BOOST_FT_MAX_ARITY 50 +# include __FILE__ + +#else + +# pragma message(generating BOOST_FT_OUT_FILE) +# pragma wave option(preserve: 2, output: BOOST_FT_OUT_FILE) +# include +# undef BOOST_FT_MAX_ARITY + +#endif + diff --git a/build/preprocess_cc_names.cpp b/build/preprocess_cc_names.cpp new file mode 100644 index 0000000..39d77c5 --- /dev/null +++ b/build/preprocess_cc_names.cpp @@ -0,0 +1,27 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef __WAVE__ +# error "Boost.Wave preprocessor required" +#endif + +#pragma wave option(line: 0, preserve: 2) +timestamp file +#pragma wave option(output: null) + +#define BOOST_FT_PREPROCESSING_MODE + + +#define BOOST_FT_OUT_FILE \ + "../../../boost/function_types/detail/pp_cc_loop/preprocessed.hpp" +#pragma message(generating BOOST_FT_OUT_FILE) +#pragma wave option(output: BOOST_FT_OUT_FILE, preserve: 2) +#include +#pragma wave option(output: null) +#undef BOOST_FT_OUT_FILE + diff --git a/build/preprocess_encoding.cpp b/build/preprocess_encoding.cpp new file mode 100644 index 0000000..e2e4a5e --- /dev/null +++ b/build/preprocess_encoding.cpp @@ -0,0 +1,45 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef __WAVE__ +# error "Boost.Wave preprocessor required" +#endif + +#pragma wave option(line: 0, preserve: 2) +timestamp file +#pragma wave option(output: null) + +#define BOOST_FT_PREPROCESSING_MODE + + +#define BOOST_FT_OUT_FILE \ + "../../../boost/function_types/detail/pp_tags/preprocessed.hpp" +#pragma message(generating BOOST_FT_OUT_FILE) +#pragma wave option(output: BOOST_FT_OUT_FILE, preserve: 2) +#include +#pragma wave option(output: null) +#undef BOOST_FT_OUT_FILE + +#define BOOST_FT_OUT_FILE \ + "../../../boost/function_types/detail/pp_variate_loop/preprocessed.hpp" +#pragma message(generating BOOST_FT_OUT_FILE) +#pragma wave option(output: BOOST_FT_OUT_FILE, preserve: 2) +#include +#pragma wave option(output: null) +#undef BOOST_FT_OUT_FILE + +#define BOOST_FT_OUT_FILE \ + "../../../boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp" +#pragma message(generating BOOST_FT_OUT_FILE) +#pragma wave option(output: BOOST_FT_OUT_FILE, preserve: 2) +#include +#pragma wave option(output: null) + +#undef BOOST_FT_OUT_FILE + + diff --git a/build/timestamps/arity_loops b/build/timestamps/arity_loops new file mode 100644 index 0000000..f91091c --- /dev/null +++ b/build/timestamps/arity_loops @@ -0,0 +1 @@ +timestamp file diff --git a/build/timestamps/cc_names b/build/timestamps/cc_names new file mode 100644 index 0000000..e33ac14 --- /dev/null +++ b/build/timestamps/cc_names @@ -0,0 +1,2 @@ +timestamp file + diff --git a/build/timestamps/encoding b/build/timestamps/encoding new file mode 100644 index 0000000..f91091c --- /dev/null +++ b/build/timestamps/encoding @@ -0,0 +1 @@ +timestamp file diff --git a/doc/Jamfile b/doc/Jamfile new file mode 100644 index 0000000..5b46953 --- /dev/null +++ b/doc/Jamfile @@ -0,0 +1,22 @@ + +# (C) Copyright Tobias Schwinger +# +# Use modification and distribution are subject to the boost Software License, +# Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). + +using quickbook ; + +xml function_types : function_types.qbk ; +boostbook standalone + : + function_types + : + boost.root=../../../.. + boost.libraries=../../../libraries.htm + chunk.first.sections=1 + chunk.section.depth=2 + generate.section.toc.level=2 + toc.section.depth=1 + toc.max.depth=1 + ; + diff --git a/doc/function_types.qbk b/doc/function_types.qbk new file mode 100644 index 0000000..0f989ae --- /dev/null +++ b/doc/function_types.qbk @@ -0,0 +1,1104 @@ +[library Boost.FunctionTypes + [quickbook 1.3] + [version 2.5] + [authors [Schwinger, Tobias]] + [copyright 2004-2007 Tobias Schwinger] + [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]) + ] + [purpose Meta-programming support library] + [category template] + [category generic] + [last-revision $Date$] +] + +[def __unspecified__ /unspecified/] + +[def __mpl__ [@../../../mpl/index.html MPL]] +[def __mpl_integral_constant__ __mpl__ - [@../../../mpl/doc/refmanual/integral-constant.html Integral Constant]] +[def __mpl_fwd_seq__ __mpl__ - [@../../../mpl/doc/refmanual/forward-sequence.html Forward Sequence]] +[def __mpl_fb_ext_ra_seq__ __mpl__ - [@../../../mpl/doc/refmanual/front-extensible-sequence.html Front] / [@../../../mpl/doc/refmanual/back-extensible-sequence.html Back ][@../../../mpl/doc/refmanual/extensible-sequence.html Extensible ][@../../../mpl/doc/refmanual/random-access-sequence.html Random Access Sequence]] +[def __mpl_lambda_expression__ __mpl__ - [@../../../mpl/doc/refmanual/lambda-expression.html Lambda Expression]] + +[def __is_function [link boost_functiontypes.reference.classification.is_function is_function]] +[def __is_function_pointer [link boost_functiontypes.reference.classification.is_function_pointer is_function_pointer]] +[def __is_function_reference [link boost_functiontypes.reference.classification.is_function_reference is_function_reference]] +[def __is_member_function_pointer [link boost_functiontypes.reference.classification.is_member_function_pointer is_member_function_pointer]] +[def __is_callable_builtin [link boost_functiontypes.reference.classification.is_callable_builtin is_callable_builtin]] +[def __is_nonmember_callable_builtin [link boost_functiontypes.reference.classification.is_nonmember_callable_builtin is_nonmember_callable_builtin]] + +[def __components [link boost_functiontypes.reference.decomposition.components components]] +[def __parameter_types [link boost_functiontypes.reference.decomposition.parameter_types parameter_types]] +[def __function_arity [link boost_functiontypes.reference.decomposition.function_arity function_arity]] +[def __result_type [link boost_functiontypes.reference.decomposition.result_type result_type]] + +[def __function_type [link boost_functiontypes.reference.synthesis.function_type function_type]] +[def __function_pointer [link boost_functiontypes.reference.synthesis.function_pointer function_pointer]] +[def __function_reference [link boost_functiontypes.reference.synthesis.function_reference function_reference] +[def __member_function_pointer [link boost_functiontypes.reference.synthesis.member_function_pointer member_function_pointer]] + +[def __null_tag [link boost_functiontypes.reference.tag_types.null_tag null_tag]] + +[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] + +[section:introduction Introduction] + +Boost.FunctionTypes provides functionality to classify, decompose and synthesize +function, function pointer, function reference and pointer to member types. + +We collectively refer to these types as /callable builtin/ types. + +In particular, the library can be used to: + +* test whether a type is a specific callable, builtin type, +* extract all component properties from callable, builtin types, and +* create callable, builtin types from specified properties. + +The library is designed to work well with other Boost libraries and uses +well-accepted concepts introduced by Boost and TR1. + +Templates that encapsulate boolean or numeric properties define a static member +constant called [^value]. + + __is_function_pointer< bool(*)(int) >::value // == true + + __function_arity< bool(*)(int) >::value // == 1 + +Templates that encapsulate properties that are single types contain a type +member called [^type]. + + __function_type< mpl::vector >::type // is bool(int) + + __result_type< bool(&)(int) >::type // is bool + +Templates that encapsulate properties that are type lists model an +MPL-compatible type sequence. + + __parameter_types< bool(int) > // models an MPL sequence + +[endsect] + +[section:use_cases Use Cases] + +Generic libraries that accept callable arguments are common in C++. +Accepting a callable argument of builin type often involves a lot of repetitive +code because the accepting function is overloaded for different function +arities. Further, member functions may have [^const]/[^volatile]-qualifiers, +a function may take a variable number of (additional, POD-typed) arguments (such +as [^printf]) and several C++ implementations encode a calling convention with +each function's type to allow calls across language or (sub-)system boundaries. + + template + void accept_function(R(* func)()); + + template + void accept_function(R(& func)()); + + template + void accept_function(R(C::* func)()); + + template + void accept_function(R(C::* func)() const); + + template + void accept_function(R(C::* func)() volatile); + + template + void accept_function(R(C::* func)() const volatile); + + template + void accept_function(R(* func)(...)); + + template + void accept_function(R(& func)(...)); + + template + void accept_function(R(C::* func)(...)); + + template + void accept_function(R(C::* func)(...) const); + + template + void accept_function(R(C::* func)(...) volatile); + + template + void accept_function(R(C::* func)(...) const volatile); + + // ... + + // needs to be repeated for every additional function parameter + // times the number of possible calling conventions + +The "overloading approach" obviously does not scale well: There might be several +functions that accept callable arguments in one library and client code might +end up using several libraries that use this pattern. +On the developer side, library developers spend their time solving the same +problem, working around the same portability issues, and apply similar +optimizations to keep the compilation time down. + +Using Boost.FunctionTypes it is possible to write a single function template +instead: + + template + void accept_function(F f) + { + // ... use Boost.FunctionTypes to analyse F + } + +The combination with a tuples library that provides an invoker component, such +as [@../../../fusion/index.html Boost.Fusion], allows to build flexible callback +facilities that are entirely free of repetitive code as shown by the +[@../../../function_types/example/interpreter.hpp interpreter example]. + +When taking the address of an overloaded function or function template, the +type of the function must be known from the context the expression is used +in. The code below shows three examples for choosing the [^float(float)] +overload of [^std::abs]. + + float (*ptr_absf)(float) = & std::abs; + + + void foo(float(*func)(float)); + + void bar() + { + foo(& std::abs); + } + + + std::transform(b, e, o, static_cast(& std::abs)); + +The library's type synthesis capabilities can be used to automate overload +selection and instantiation of function templates. Given an overloaded function +template + + template + R overloaded(T0); + + template + R overloaded(T0,T1); + + template + R overloaded(T0,T1,T2); + +we can pick any of the three overloads and instantiate the template with +template arguments from a type sequence in a single expression: + + static_cast<__function_pointer::type>(& overloaded) + +This technique can be occasionally more flexible than template argument +deduction from a function call because the exact types from the sequence +are used to specialize the template (including possibly cv-qualified +reference types and the result type). It is applied twice in the +[@../../../function_types/example/interface.hpp interface example]. + +Another interersting property of callable, builtin types is that they can be +valid types for non-type template parameters. This way, a function can be +pinpointed at compile time, allowing the compiler to eliminate the call by +inlining. +The [@../../../function_types/example/fast_mem_fn.hpp fast_mem_fn example] +exploits this characteristic and implements a potentially inlining version of +[@../../../bind/mem_fn.html boost::mem_fn] +limited to member functions that are known at compile time. + +[endsect] + + +[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] +[section:about_tag_types About Tag Types] + +Boost.FunctionTypes uses tag types to encode properties that are not types +per se, such as calling convention or whether a function is variadic or cv- +qualified. + +These tags can be used to determine whether one property of a type has a +particular value. + + is_function::value // == true + is_function::value // == false + +A compound property tag describes a combination of possible values of different +properties. +The type [^components], where [^F] is a callable builtin type, is a compound +property tag that describes [^F]. +The [^tag] class template can be used to combine property tags. + + tag // combination of two properties + +When several values for the same property are specified in [^tag]'s argument +list, only the rightmost one is used; others are ignored. + + tag, default_cc> // overrides F's calling convention property + +When compound property tag is specified to analyse a type, all of its component +properties must match. + + is_member_function_pointer< F, tag >::value + // true for + // F = void(a_class::*)() const + // false for + // F = void(a_class::*)() + // F = void(__fastcall a_class::*)() const + +Default values are selected for properties not specified by the tag in the +context of type synthesis. + + // given S = mpl::vector + + member_function_pointer::type // is int (a_class::*)() const + // note: the cv-qualification is picked based on the class type, + // a nonvariadic signature and the default calling convention + // are used + + member_function_pointer::type // is int (a_class::*)() + // no const qualification, as explicitly specified by the tag type + +[endsect] + + +[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] + +[section:reference Reference] + + +[section:classification Class templates for type classification] + +[section:is_function is_function] + + template + struct is_function; + +[*Header] + + #include + +[variablelist + [[[^T]][Type to analyze]] + [[[^Tag]][Further properties required for a positive result]] + [[[^is_function]][Predicate value as __mpl_integral_constant__]] + [[[^is_function::value]][Constant boolean value]] +] + +Determines whether a given type is a function, possibly with +additional properties as specified by a property tag. + +[endsect] + + +[section:is_function_pointer is_function_pointer] + + template + struct is_function_pointer; + +[*Header] + + #include + +[variablelist + [[[^T]][Type to analyze]] + [[[^Tag]][Further properties required for a positive result]] + [[[^is_function_pointer]][Predicate value __mpl_integral_constant__]] + [[[^is_function_pointer::value]][Constant boolean value]] +] + +Determines whether a given type is a function pointer, possibly with +additional properties as specified by a property tag. + +[endsect] + + +[section:is_function_reference is_function_reference] + + template + struct is_function_reference; + +[*Header] + + #include + +[variablelist + [[[^T]][Type to analyze]] + [[[^Tag]][Further properties required for a positive result]] + [[[^is_function_reference]][Predicate value __mpl_integral_constant__]] + [[[^is_function_reference::value]][Constant boolean value]] +] + +Determines whether a given type is a function reference, possibly with +additional properties as specified by a property tag. + +[endsect] + + +[section:is_member_pointer is_member_pointer] + + template + struct is_member_pointer; + +[*Header] + + #include + +[variablelist + [[[^T]][Type to analyze]] + [[[^Tag]][Further properties required for a positive result]] + [[[^is_member_pointer]][Predicate value __mpl_integral_constant__]] + [[[^is_member_pointer::value]][Constant boolean value]] +] + +Determines whether a given type is a pointer to member (object or function) +type, possibly with additional properties as specified by a property tag. + +[endsect] + + +[section:is_member_object_pointer is_member_object_pointer] + + template + struct is_member_object_pointer; + +[*Header] + + #include + +[variablelist + [[[^T]][Type to analyze]] + [[[^is_member_object_pointer]][Predicate value __mpl_integral_constant__]] + [[[^is_member_object_pointer::value]][Constant boolean value]] +] + +Determines whether a given type is a pointer to member object type. + +[endsect] + + +[section:is_member_function_pointer is_member_function_pointer] + + template + struct is_member_function_pointer; + +[*Header] + + #include + +[variablelist + [[[^T]][Type to analyze]] + [[[^Tag]][Further properties required for a positive result]] + [[[^is_member_function_pointer]][Predicate value __mpl_integral_constant__]] + [[[^is_member_function_pointer::value]][Constant boolean value]] +] + +Determines whether a given type is a member function pointer, possibly with +additional properties as specified by a property tag. + +[endsect] + + +[section:is_callable_builtin is_callable_builtin] + + template + struct is_callable_builtin; + +[*Header] + + #include + +[variablelist + [[[^T]][Type to analyze]] + [[[^Tag]][Further properties required for a positive result]] + [[[^is_callable_builtin]][Predicate value as __mpl_integral_constant__]] + [[[^is_callable_builtin::value]][Constant boolean value]] +] + +Determines whether a given type is a callable builtin, possibly with +additional properties as specified by a property tag. + +[endsect] + + + +[section:is_nonmember_callable_builtin is_nonmember_callable_builtin] + + template + struct is_nonmember_callable_builtin; + +[*Header] + + #include + +[variablelist + [[[^T]][Type to analyze]] + [[[^Tag]][Further properties required for a positive result]] + [[[^is_nonmember_callable_builtin]][Predicate value as __mpl_integral_constant__]] + [[[^is_nonmember_callable_builtin::value]][Constant boolean value]] +] + +Determines whether a given type is a callable builtin that is not a +member function pointer, possibly with +additional properties as specified by a property tag. + +[endsect] + + +[endsect] [/ Class templates for type classification ] + +[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] + +[section:decomposition Class templates for type decomposition] + + +[section:result_type result_type] + + template + struct result_type; + +[*Header] + + #include + +[variablelist + [[[^F]][Type to analyze]] + [[[^result_type::type]][Result type of [^F]]] +] + +Extracts the result type of a callable, builtin type. + +If [^F] is no callable, builtin type, any attempt to access the +[^type] member results in a compile error. + +[endsect] + + +[section:parameter_types parameter_types] + + template > + struct parameter_types; + +[*Header] + + #include + +[variablelist + [[[^F]][Type to analyze]] + [[[^ClassTransform]] + [__mpl_lambda_expression__ to transform the + class type if [^F] is a member function pointer]] + + [[[^parameter_types]] + [__mpl_fb_ext_ra_seq__ of parameter types]] +] + +Extracts the parameter types of a callable, builtin type. + +If [^F] is no callable, builtin type, any attempt to access the +sequence results in a compile error. + +[endsect] + + +[section:function_arity function_arity] + + template + struct function_arity; + +[*Header] + + #include + +[variablelist + [[[^F]][Callable builtin type]] + [[[^function_arity]][Function arity as __mpl_integral_constant__]] + [[[^function_arity::value]][Constant value of the function arity]] +] + +Extracts the function arity, that is the number of parameters. +The hidden [^this] of member function pointers counts, in other words +the arity value is always greater than or equal to one if [^F] is a +member function pointer. + +If [^F] is no callable, builtin type, any attempt to access the +value results in a compile error. + +[endsect] + + +[section:components components] + + template > + struct components; + +[*Header] + + #include + +[variablelist + [[[^T]][Type to analyze]] + [[[^ClassTransform]] + [__mpl_lambda_expression__ to transform the + class type if [^T] is a member function pointer]] + + [[[^components]] + [__mpl_fb_ext_ra_seq__ of all + component types and property tag]] + [[[^components::types]] + [Decorated MPL Sequence, exposed for optimization]] +] + +Extracts all properties of a callable builtin type, that is the result type, +followed by the parameter types (including the type of [^this] for member +function pointers). + +If [^T] is no callable builtin type, the component types are an empty +sequence and the Tag's meaning is equivalent to the [^__null_tag]. + +[endsect] + +[endsect] [/ Class templates for type decomposition] + +[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] + +[section:synthesis Class templates for type synthesis] + + +[section:function_type function_type] + + template + struct function_type; + +[*Header] + + #include + +[variablelist + [[[^Types]][Component types in form of an __mpl_fwd_seq__ or another callable, builtin type]] + [[[^Tag]][Further properties]] + [[[^function_type::type]][Synthesized type]] +] + +Synthesizes a function type from given properties. + +If the template parameters do not describe a valid type, any attempt +to access the [^type] member will result in a compile error. + +[endsect] + + +[section:function_pointer function_pointer] + + template + struct function_pointer; + +[*Header] + + #include + +[variablelist + [[[^Types]][Component types in form of an __mpl_fwd_seq__ or another callable, builtin type]] + [[[^Tag]][Further properties]] + [[[^function_pointer::type]][Synthesized type]] +] + +Synthesizes a function pointer type from given properties. + +If the template parameters do not describe a valid type, any attempt +to access the [^type] member will result in a compile error. + +[endsect] + + +[section:function_reference function_reference] + + template + struct function_reference; + +[*Header] + + #include + +[variablelist + [[[^Types]][Component types in form of an __mpl_fwd_seq__ or another callable, builtin type]] + [[[^Tag]][Further properties]] + [[[^function_reference::type]][Synthesized type]] +] + +Synthesizes a function reference type from given properties. + +If the template parameters do not describe a valid type, any attempt +to access the [^type] member will result in a compile error. + +[endsect] + + +[section:member_function_pointer member_function_pointer] + + template + struct member_function_pointer; + +[*Header] + + #include + +[variablelist + [[[^Types]][Component types in form of an __mpl_fwd_seq__ or another callable, builtin type]] + [[[^Tag]][Further properties]] + [[[^member_function_pointer::type]][Synthesized type]] +] + +Synthesizes a member function pointer type from given properties. + +An optional reference or possibly cv-qualified pointer is removed from +the second type in the sequence to determine the the class type. +The cv-qualification of the resulting type applies to the member +function, unless otherwise explicitly specified by the property tag. + +If the template parameters do not describe a valid type, any attempt +to access the [^type] member will result in a compile error. + +[endsect] + + +[endsect] [/ Class templates for type synthesis ] + +[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] + +[section:tag_types Tag Types] + +[section:variadic variadic] + + typedef __unspecified__ variadic; + +[*Header] + + #include + +States that a function type takes a variable number of arguments through +an ellipsis parameter (such as [^printf]). + +[endsect] + +[section:non_variadic non_variadic] + + typedef __unspecified__ non_variadic; + +[*Header] + + #include + +States that a function type does not have an ellipsis parameter. + +[endsect] + +[section:default_cc default_cc] + + typedef __unspecified__ default_cc; + +[*Header] + + #include + +States that a function type encodes the default calling convention. + +[endsect] + +[section:const_qualified const_qualified] + + typedef __unspecified__ const_qualified; + +[*Header] + + #include + +States that a function type is const qualified. + +[endsect] + +[section:non_const non_const] + + typedef __unspecified__ non_const; + +[*Header] + + #include + +States that a function type is not const qualified. + +[endsect] + +[section:volatile_qualified volatile_qualified] + + typedef __unspecified__ volatile_qualified; + +[*Header] + + #include + +States that a function type is volatile qualified. + +[endsect] + +[section:non_volatile non_volatile] + + typedef __unspecified__ non_volatile; + +[*Header] + + #include + +States that a function type is not volatile qualified. + +[endsect] + +[section:non_cv non_cv] + + typedef __unspecified__ non_cv; + +[*Header] + + #include + +States that a function type is neither const nor volatile qualified. +Equivalent to `__tag<__non_const,__non_volatile>`, but involves +fewer template instantiations when evaluated. + +[endsect] + +[section:const_non_volatile const_non_volatile] + + typedef __unspecified__ const_non_volatile; + +[*Header] + + #include + +States that a function type is const but not volatile qualified. +Equivalent to `__tag<__const_qualified,__non_volatile>`, but involves +fewer template instantiations when evaluated. + +[endsect] + +[section:volatile_non_const volatile_non_const] + + typedef __unspecified__ volatile_non_const; + +[*Header] + + #include + +States that a function type is volatile but not const qualified. +Equivalent to `__tag<__volatile_qualified,__non_const>`, but involves +fewer template instantiations when evaluated. + +[endsect] + +[section:cv_qualfied cv_qualfied] + + typedef __unspecified__ cv_qualified; + +[*Header] + + #include + +States that a function type is both const and volatile qualified. +Equivalent to `__tag<__const_qualified,__volatile_qualified>`, but involves +fewer template instantiations when evaluated. + +[endsect] + +[section:null_tag null_tag] + + typedef __unspecified__ null_tag; + +[*Header] + + #include + +States nothing. + +[endsect] + +[section:tag tag] + + template + struct tag; + +[*Header] + + #include + +[variablelist + [[[^Tag['N]]][Property tag]] + [[[^tag]][Compound property tag]] +] + +Combination of up to four property tags. If the arguments describe different +values for the same property the value of the rightmost argument is used. + +[endsect] + +[endsect] [/ Tag Types] + +[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] + +[section:macros Macros] + +[section:BOOST_FT_MAX_ARITY BOOST_FT_MAX_ARITY] + +Expands to a numeric value that describes the maximum function arity +supported by the library. + +Defaults to 20 if not explicitly defined by the user before inclusion +of the first library header. + +[endsect] + + + +[*The following macros do not need to be defined, unless to configure +the library to work with a compiler and/or calling convention not covered by +the auto-detection mechanism in [^boost/function_types/config/compiler.hpp].] + + +[section:BOOST_FT_CC_NAMES BOOST_FT_CC_NAMES] + +Expands to a [@../../../preprocessor/doc/data/sequences.html sequence] of +ternary [@../../../preprocessor/doc/data/tuples.html tuples] (these data +types are defined in the [@../../../preprocessor/doc/index.html +documentation of the Boost Preprocessor library]). +Each sequence element describes one calling convention specifier. +The first element in each tuple is the macro suffix for +[link boost_functiontypes.reference.macros.BOOST_FT_CC [^BOOST_FT\_CC\_*]], +the second element is the name of the tag that describes the calling +convention and the third is the name of the specifier. +The specifier is allowed to be an empty string, so the third tuple element +is either [@../../../preprocessor/doc/ref/empty.html [^BOOST_PP_EMPTY]] or +[@../../../preprocessor/doc/ref/identity.html [^BOOST_PP_IDENTITY]][^(['name])]. + +Define this macro to extend the set of possible names for custom calling +conventions. The macro expands to nothing by default. + +The following names are predefined by the library and must not occur in the +definition of [^BOOST_FT_CC_NAMES]: + + #define BOOST_FT_BUILTIN_CC_NAMES \ + (( IMPLICIT , implicit_cc , BOOST_PP_EMPTY ))\ + (( CDECL , cdecl_cc , BOOST_PP_IDENTITY(__cdecl ) ))\ + (( STDCALL , stdcall_cc , BOOST_PP_IDENTITY(__stdcall ) ))\ + (( PASCAL , pascal_cc , BOOST_PP_IDENTITY(pascal ) ))\ + (( FASTCALL , fastcall_cc , BOOST_PP_IDENTITY(__fastcall) ))\ + (( CLRCALL , clrcall_cc , BOOST_PP_IDENTITY(__clrcall ) ))\ + (( THISCALL , thiscall_cc , BOOST_PP_IDENTITY(__thiscall) ))\ + (( IMPLICIT_THISCALL , thiscall_cc , BOOST_PP_EMPTY )) + // Don't get confused by the last line, here (thiscall can't be specified + // explicitly prior to MSVC 8). + +[endsect] + +[section:BOOST_FT_CC BOOST_FT\_CC\_*] + +Enables a specific calling convention. * dentoes the macro suffix, as +defined by +[link boost_functiontypes.reference.macros.BOOST_FT_CC_NAMES [^BOOST_FT_CC_NAMES]] +or +[link boost_functiontypes.reference.macros.BOOST_FT_CC_NAMES [^BOOST_FT_BUILTIN_CC_NAMES]]. + +The macro expands to a list of restrictions, separated by the [^|] character. +Possible items are: + +* callable_builtin +* member +* non_member +* variadic +* non_variadic + +If no such macro is defined for a particular calling convention, it is disabled. +Example: + + #define BOOST_FT_CC_STDCALL non_variadic|callable_builtin + // enables stdcall calling convention for all non-variadic, + // callable, builtin types + +[endsect] + +[section:BOOST_FT_COMMON_X86_CCs BOOST_FT_COMMON_X86_CCs] + +Defining this macro causes the following macros to be defined, if not defined +already: + + #define BOOST_FT_CC_CDECL BOOST_FT_COMMON_X86_CCs + #define BOOST_FT_CC_STDCALL non_variadic|BOOST_FT_COMMON_X86_CCs + #define BOOST_FT_CC_FASTCALL non_variadic|BOOST_FT_COMMON_X86_CCs + +[endsect] + +[section:BOOST_FT_SYNTAX BOOST_FT_SYNTAX] + +This macro allows to change the syntax of callable builtin types. +It is useful to handle the compiler specific placement of the calling +convention specifier. + +The default definition is as follows: + + #define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \ + result() lparen() cc_spec() type_mod() name() rparen() + +[endsect] + +[section:BOOST_FT_NULLARY_PARAM BOOST_FT_NULLARY_PARAM] + +Set to [^void] for compilers that insist on a [^void] parameter for +nullary function types, empty by default. + +[endsect] + +[section:BOOST_FT_NO_CV_FUNC_SUPPORT BOOST_FT_NO_CV_FUNC_SUPPORT] + +Disables support for cv-qualified function types. +Cv-qualified function types are illegal by the current standard +version, but there is a pending defect report on that issue. +It defaults to [^1] until the standard changes, setting this macro +to [^0] may not work. + +[endsect] + + + +[*The following macros are useful for testing when changing the source code of +the library.] + + + +[section:BOOST_FT_PREPROCESSING_MODE BOOST_FT_PREPROCESSING_MODE] + +Makes the compiler preprocess as much as possible of the library code +(rather than loading already-preprocessed header files) if defined. + +[endsect] + +[section:BOOST_FT_CC_PREPROCESSING BOOST_FT_CC_PREPROCESSING] + +Makes the compiler preprocess the loop over possible names for custom +calling conventions (rather than loading an already-preprocessed header +file) if defined. + +This macro is defined automatically if +[link boost_functiontypes.reference.macros.BOOST_FT_CC_NAMES [^BOOST_FT_CC_NAMES]] +has been defined. + +[endsect] + +[endsect] + +[endsect] + +[/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] + +[section:rationale Rationale] + +[heading Error handling rationale] + +The library does not define the required members of class templates in +case of an error. This technique causes the compiler to stop displaying +diagnostics in client code, at the point where the error actually is, +instead of tracing template instantiations into the implementation of +the library. + +The library's components have limited error conditions, so problematic +input can be spotted easily. + + +[heading Why MPL Sequences?] + +MPL provides algorithms on Sequences, so transformations (such as turning +by-value parameter types into const references for optimized forwarding +or computing a signature to specialize +[@../../../function/index.html [^boost::function]] after applying +[@../../../bind/index.html [^boost::bind]]) can be expressed more +easily. The MPL Sequence concept is compatible with several other Boost +libraries (most importantly [@../../../fusion/index.html Fusion]), +so another reason is interoperability. + + +[heading Pointer to member object types] + +Despite their syntax, pointer to member object types can be seen as +dereferencing functionals. + + +[heading The ClassTransform template parameter] + +[^This]-pointer, [^this]-reference or just the object (or maybe even a +smart pointer to the object) plus adjustments of cv-qualification - all +these cases have their place, somewhere and there is no single best answer. + +Special treatment of the class type within the sequence can significantly +complicate client code. A custom [^ClassTransform] argument allows the +client to adjust the class type before the sequence is formed and then +treat all parameters uniformly. + + +[heading Why tag types?] + +Let's consider the alternatives. + +The first one is just using more templates so every property has to be +asked for explicitly. This approach results in more complicated client +code if more than one propery has to be checked and in a exponentially +larger library interface. + +The second alternative is having the client pass in bit patterns via +non-type template parameters. The logic has to be performed by the +client and there are much more error conditions. Further, class templates +with non-type template parameters do not work within MPL lambda +expressions and can cause problems with older compilers. + +[heading Is it safe to have the synthesis templates take a callable +builtin type or an MPL sequence as the first template argument?] + +Yes, but it isn't immediately obvious as the set of possible MPL sequences +isn't inherently disjoint from the set of callable builtin types. + +However, any attempt to make a builtin type work as an MPL sequence is +a bad idea, because builtin types are accessible before the headers that +make the type a sequence have been included, which can easily violate the +ODR. + +[heading Why does the hidden [^this] parameter count for the +function arity of member functions?] + +It was found preferable that the following condition holds: + + mpl::size< __parameter_types >::value == __function_arity::value + +[heading Why ignore top-level cv-qualifiers on pointers?] + +A cv-qualified pointer is still a pointer. It usually doesn't matter and +even if it does, it's a job for +[@../../../type_traits/index.html Boost.TypeTraits]. + + +[endsect] + +[section:acknowledgements Acknowledgements] + +Thanks go to the following people for supporting the development of this +library in one or the other way: + +* David Abrahams +* Tom Brinkman +* Aleksey Gurtovoy +* Jody Hagins +* Hartmut Kaiser +* Andy Little +* John Maddock +* Paul Mensonides +* Alexander Nasonov +* Richard Smith +* Rob Stewart +* Jonathan Turkanis +* Pavel Vozenilek +* Steven Watanabe + +[endsect] + diff --git a/doc/html/boost_functiontypes/about_tag_types.html b/doc/html/boost_functiontypes/about_tag_types.html new file mode 100644 index 0000000..217b2ab --- /dev/null +++ b/doc/html/boost_functiontypes/about_tag_types.html @@ -0,0 +1,94 @@ + + + + About Tag Types + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +

+ Boost.FunctionTypes uses tag types to encode properties that are not types + per se, such as calling convention or whether a function is variadic or cv- + qualified. +

+

+ These tags can be used to determine whether one property of a type has a particular + value. +

+
+is_function<int(...), variadic>::value // == true
+is_function<int()   , variadic>::value // == false
+
+

+ A compound property tag describes a combination of possible values of different + properties. The type components<F>, where F + is a callable builtin type, is a compound property tag that describes F. + The tag class template can be used to combine property tags. +

+
+tag<non_const,default_cc> // combination of two properties
+
+

+ When several values for the same property are specified in tag's + argument list, only the rightmost one is used; others are ignored. +

+
+tag<components<F>, default_cc> // overrides F's calling convention property
+
+

+ When compound property tag is specified to analyse a type, all of its component + properties must match. +

+
+is_member_function_pointer< F, tag<const_qualified,default_cc> >::value
+// true for 
+//   F = void(a_class::*)() const
+// false for
+//   F = void(a_class::*)()
+//   F = void(__fastcall a_class::*)() const
+
+

+ Default values are selected for properties not specified by the tag in the + context of type synthesis. +

+
+// given S = mpl::vector<int,a_class const &>
+
+member_function_pointer<S>::type // is int (a_class::*)() const
+// note: the cv-qualification is picked based on the class type,
+// a nonvariadic signature and the default calling convention 
+// are used
+
+member_function_pointer<S,non_const>::type // is int (a_class::*)()
+// no const qualification, as explicitly specified by the tag type
+
+
+ + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_functiontypes/acknowledgements.html b/doc/html/boost_functiontypes/acknowledgements.html new file mode 100644 index 0000000..e8c7c26 --- /dev/null +++ b/doc/html/boost_functiontypes/acknowledgements.html @@ -0,0 +1,85 @@ + + + + Acknowledgements + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHome +
+
+ +

+ Thanks go to the following people for supporting the development of this library + in one or the other way: +

+
    +
  • + David Abrahams +
  • +
  • + Tom Brinkman +
  • +
  • + Aleksey Gurtovoy +
  • +
  • + Jody Hagins +
  • +
  • + Hartmut Kaiser +
  • +
  • + Andy Little +
  • +
  • + John Maddock +
  • +
  • + Paul Mensonides +
  • +
  • + Alexander Nasonov +
  • +
  • + Richard Smith +
  • +
  • + Rob Stewart +
  • +
  • + Jonathan Turkanis +
  • +
  • + Pavel Vozenilek +
  • +
  • + Steven Watanabe +
  • +
+
+ + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHome +
+ + diff --git a/doc/html/boost_functiontypes/introduction.html b/doc/html/boost_functiontypes/introduction.html new file mode 100644 index 0000000..58151d4 --- /dev/null +++ b/doc/html/boost_functiontypes/introduction.html @@ -0,0 +1,94 @@ + + + + Introduction + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +

+ Boost.FunctionTypes provides functionality to classify, decompose and synthesize + function, function pointer, function reference and pointer to member types. +

+

+ We collectively refer to these types as callable builtin + types. +

+

+ In particular, the library can be used to: +

+
    +
  • + test whether a type is a specific callable, builtin type, +
  • +
  • + extract all component properties from callable, builtin types, and +
  • +
  • + create callable, builtin types from specified properties. +
  • +
+

+ The library is designed to work well with other Boost libraries and uses well-accepted + concepts introduced by Boost and TR1. +

+

+ Templates that encapsulate boolean or numeric properties define a static member + constant called value. +

+
+is_function_pointer< bool(*)(int) >::value // == true 
+
+function_arity< bool(*)(int) >::value // == 1
+
+

+ Templates that encapsulate properties that are single types contain a type + member called type. +

+
+function_type< mpl::vector<bool,int> >::type // is bool(int)
+
+result_type< bool(&)(int) >::type // is bool
+
+

+ Templates that encapsulate properties that are type lists model an MPL-compatible + type sequence. +

+
+parameter_types< bool(int) > // models an MPL sequence
+
+
+ + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_functiontypes/rationale.html b/doc/html/boost_functiontypes/rationale.html new file mode 100644 index 0000000..1b71df4 --- /dev/null +++ b/doc/html/boost_functiontypes/rationale.html @@ -0,0 +1,149 @@ + + + + Rationale + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +

+ + Error + handling rationale +

+

+ The library does not define the required members of class templates in case + of an error. This technique causes the compiler to stop displaying diagnostics + in client code, at the point where the error actually is, instead of tracing + template instantiations into the implementation of the library. +

+

+ The library's components have limited error conditions, so problematic input + can be spotted easily. +

+

+ + Why MPL Sequences? +

+

+ MPL provides algorithms on Sequences, so transformations (such as turning by-value + parameter types into const references for optimized forwarding or computing + a signature to specialize boost::function + after applying boost::bind) + can be expressed more easily. The MPL Sequence concept is compatible with several + other Boost libraries (most importantly Fusion), + so another reason is interoperability. +

+

+ + Pointer + to member object types +

+

+ Despite their syntax, pointer to member object types can be seen as dereferencing + functionals. +

+

+ + The + ClassTransform template parameter +

+

+ This-pointer, this-reference or just + the object (or maybe even a smart pointer to the object) plus adjustments of + cv-qualification - all these cases have their place, somewhere and there is + no single best answer. +

+

+ Special treatment of the class type within the sequence can significantly complicate + client code. A custom ClassTransform argument allows the + client to adjust the class type before the sequence is formed and then treat + all parameters uniformly. +

+

+ + Why tag types? +

+

+ Let's consider the alternatives. +

+

+ The first one is just using more templates so every property has to be asked + for explicitly. This approach results in more complicated client code if more + than one propery has to be checked and in a exponentially larger library interface. +

+

+ The second alternative is having the client pass in bit patterns via non-type + template parameters. The logic has to be performed by the client and there + are much more error conditions. Further, class templates with non-type template + parameters do not work within MPL lambda expressions and can cause problems + with older compilers. +

+

+ + Is + it safe to have the synthesis templates take a callable builtin type or an + MPL sequence as the first template argument? +

+

+ Yes, but it isn't immediately obvious as the set of possible MPL sequences + isn't inherently disjoint from the set of callable builtin types. +

+

+ However, any attempt to make a builtin type work as an MPL sequence is a bad + idea, because builtin types are accessible before the headers that make the + type a sequence have been included, which can easily violate the ODR. +

+

+ + Why + does the hidden this parameter count for the function arity + of member functions? +

+

+ It was found preferable that the following condition holds: +

+
+mpl::size< parameter_types<T> >::value == function_arity<T>::value
+
+

+ + Why + ignore top-level cv-qualifiers on pointers? +

+

+ A cv-qualified pointer is still a pointer. It usually doesn't matter and even + if it does, it's a job for Boost.TypeTraits. +

+
+ + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_functiontypes/reference.html b/doc/html/boost_functiontypes/reference.html new file mode 100644 index 0000000..f54c521 --- /dev/null +++ b/doc/html/boost_functiontypes/reference.html @@ -0,0 +1,49 @@ + + + + Reference + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+ + + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_functiontypes/reference/classification.html b/doc/html/boost_functiontypes/reference/classification.html new file mode 100644 index 0000000..7ef1d9e --- /dev/null +++ b/doc/html/boost_functiontypes/reference/classification.html @@ -0,0 +1,407 @@ + + + + Class + templates for type classification + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ + +
+ +
+template<typename T, typename Tag = null_tag>
+struct is_function;
+
+

+ Header +

+
+#include <boost/function_types/is_function.hpp>
+
+
+

+
+
T
+

+ Type to analyze +

+
Tag
+

+ Further properties required for a positive result +

+
is_function<T,Tag>
+

+ Predicate value as MPL + - Integral + Constant +

+
is_function<T,Tag>::value
+

+ Constant boolean value +

+
+
+

+ Determines whether a given type is a function, possibly with additional + properties as specified by a property tag. +

+
+
+ +
+template<typename T, typename Tag = null_tag>
+struct is_function_pointer;
+
+

+ Header +

+
+#include <boost/function_types/is_function_pointer.hpp>
+
+
+

+
+
T
+

+ Type to analyze +

+
Tag
+

+ Further properties required for a positive result +

+
is_function_pointer<T,Tag>
+

+ Predicate value MPL - + Integral + Constant +

+
is_function_pointer<T,Tag>::value
+

+ Constant boolean value +

+
+
+

+ Determines whether a given type is a function pointer, possibly with additional + properties as specified by a property tag. +

+
+
+ +
+template<typename T, typename Tag = null_tag>
+struct is_function_reference;
+
+

+ Header +

+
+#include <boost/function_types/is_function_reference.hpp>
+
+
+

+
+
T
+

+ Type to analyze +

+
Tag
+

+ Further properties required for a positive result +

+
is_function_reference<T,Tag>
+

+ Predicate value MPL - + Integral + Constant +

+
is_function_reference<T,Tag>::value
+

+ Constant boolean value +

+
+
+

+ Determines whether a given type is a function reference, possibly with + additional properties as specified by a property tag. +

+
+
+ +
+template<typename T, typename Tag = null_tag>
+struct is_member_pointer;
+
+

+ Header +

+
+#include <boost/function_types/is_member_pointer.hpp>
+
+
+

+
+
T
+

+ Type to analyze +

+
Tag
+

+ Further properties required for a positive result +

+
is_member_pointer<T,Tag>
+

+ Predicate value MPL - + Integral + Constant +

+
is_member_pointer<T,Tag>::value
+

+ Constant boolean value +

+
+
+

+ Determines whether a given type is a pointer to member (object or function) + type, possibly with additional properties as specified by a property tag. +

+
+
+ +
+template<typename T>
+struct is_member_object_pointer;
+
+

+ Header +

+
+#include <boost/function_types/is_member_object_pointer.hpp>
+
+
+

+
+
T
+

+ Type to analyze +

+
is_member_object_pointer<T>
+

+ Predicate value MPL - + Integral + Constant +

+
is_member_object_pointer<T>::value
+

+ Constant boolean value +

+
+
+

+ Determines whether a given type is a pointer to member object type. +

+
+
+ +
+template<typename T, typename Tag = null_tag>
+struct is_member_function_pointer;
+
+

+ Header +

+
+#include <boost/function_types/is_member_function_pointer.hpp>
+
+
+

+
+
T
+

+ Type to analyze +

+
Tag
+

+ Further properties required for a positive result +

+
is_member_function_pointer<T,Tag>
+

+ Predicate value MPL - + Integral + Constant +

+
is_member_function_pointer<T,Tag>::value
+

+ Constant boolean value +

+
+
+

+ Determines whether a given type is a member function pointer, possibly + with additional properties as specified by a property tag. +

+
+
+ +
+template<typename T, typename Tag = null_tag>
+struct is_callable_builtin;
+
+

+ Header +

+
+#include <boost/function_types/is_callable_builtin.hpp>
+
+
+

+
+
T
+

+ Type to analyze +

+
Tag
+

+ Further properties required for a positive result +

+
is_callable_builtin<T,Tag>
+

+ Predicate value as MPL + - Integral + Constant +

+
is_callable_builtin<T,Tag>::value
+

+ Constant boolean value +

+
+
+

+ Determines whether a given type is a callable builtin, possibly with additional + properties as specified by a property tag. +

+
+
+ +
+template<typename T, typename Tag = null_tag>
+struct is_nonmember_callable_builtin;
+
+

+ Header +

+
+#include <boost/function_types/is_nonmember_callable_builtin.hpp>
+
+
+

+
+
T
+

+ Type to analyze +

+
Tag
+

+ Further properties required for a positive result +

+
is_nonmember_callable_builtin<T,Tag>
+

+ Predicate value as MPL + - Integral + Constant +

+
is_nonmember_callable_builtin<T,Tag>::value
+

+ Constant boolean value +

+
+
+

+ Determines whether a given type is a callable builtin that is not a member + function pointer, possibly with additional properties as specified by a + property tag. +

+
+
+ + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_functiontypes/reference/decomposition.html b/doc/html/boost_functiontypes/reference/decomposition.html new file mode 100644 index 0000000..91ebf50 --- /dev/null +++ b/doc/html/boost_functiontypes/reference/decomposition.html @@ -0,0 +1,233 @@ + + + + Class templates + for type decomposition + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ + +
+ +
+template<typename F>
+struct result_type;
+
+

+ Header +

+
+#include <boost/function_types/result_type.hpp>
+
+
+

+
+
F
+

+ Type to analyze +

+
result_type<F>::type
+

+ Result type of F +

+
+
+

+ Extracts the result type of a callable, builtin type. +

+

+ If F is no callable, builtin type, any attempt to access + the type member results in a compile error. +

+
+
+ +
+template<typename F, class ClassTransform = add_reference<_> >
+struct parameter_types;
+
+

+ Header +

+
+#include <boost/function_types/parameter_types.hpp>
+
+
+

+
+
F
+

+ Type to analyze +

+
ClassTransform
+

+ MPL - Lambda + Expression to transform the class type if F + is a member function pointer +

+
parameter_types<F,ClassTransform>
+

+ MPL - Front + / Back + Extensible + Random + Access Sequence of parameter types +

+
+
+

+ Extracts the parameter types of a callable, builtin type. +

+

+ If F is no callable, builtin type, any attempt to access + the sequence results in a compile error. +

+
+
+ +
+template<typename F>
+struct function_arity;
+
+

+ Header +

+
+#include <boost/function_types/function_arity.hpp>
+
+
+

+
+
F
+

+ Callable builtin type +

+
function_arity<F>
+

+ Function arity as MPL + - Integral + Constant +

+
function_arity<F>::value
+

+ Constant value of the function arity +

+
+
+

+ Extracts the function arity, that is the number of parameters. The hidden + this of member function pointers counts, in other words + the arity value is always greater than or equal to one if F + is a member function pointer. +

+

+ If F is no callable, builtin type, any attempt to access + the value results in a compile error. +

+
+
+ +
+template<typename T, class ClassTransform = add_reference<_> >
+struct components;
+
+

+ Header +

+
+#include <boost/function_types/components.hpp>
+
+
+

+
+
T
+

+ Type to analyze +

+
ClassTransform
+

+ MPL - Lambda + Expression to transform the class type if T + is a member function pointer +

+
components<T,ClassTransform>
+

+ MPL - Front + / Back + Extensible + Random + Access Sequence of all component types and property tag +

+
components<T,ClassTransform>::types
+

+ Decorated MPL Sequence, exposed for optimization +

+
+
+

+ Extracts all properties of a callable builtin type, that is the result + type, followed by the parameter types (including the type of this + for member function pointers). +

+

+ If T is no callable builtin type, the component types + are an empty sequence and the Tag's meaning is equivalent to the null_tag. +

+
+
+ + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_functiontypes/reference/macros.html b/doc/html/boost_functiontypes/reference/macros.html new file mode 100644 index 0000000..24c18db --- /dev/null +++ b/doc/html/boost_functiontypes/reference/macros.html @@ -0,0 +1,246 @@ + + + + Macros + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ + +
+ +

+ Expands to a numeric value that describes the maximum function arity supported + by the library. +

+

+ Defaults to 20 if not explicitly defined by the user before inclusion of + the first library header. +

+
+

+ The following macros do not need to be defined, unless + to configure the library to work with a compiler and/or calling convention + not covered by the auto-detection mechanism in boost/function_types/config/compiler.hpp. +

+
+ +

+ Expands to a sequence + of ternary tuples + (these data types are defined in the documentation + of the Boost Preprocessor library). Each sequence element describes + one calling convention specifier. The first element in each tuple is the + macro suffix for BOOST_FT_CC_*, + the second element is the name of the tag that describes the calling convention + and the third is the name of the specifier. The specifier is allowed to + be an empty string, so the third tuple element is either BOOST_PP_EMPTY + or BOOST_PP_IDENTITY(name). +

+

+ Define this macro to extend the set of possible names for custom calling + conventions. The macro expands to nothing by default. +

+

+ The following names are predefined by the library and must not occur in + the definition of BOOST_FT_CC_NAMES: +

+
+#define BOOST_FT_BUILTIN_CC_NAMES \
+  (( IMPLICIT           , implicit_cc , BOOST_PP_EMPTY                ))\
+  (( CDECL              , cdecl_cc    , BOOST_PP_IDENTITY(__cdecl   ) ))\
+  (( STDCALL            , stdcall_cc  , BOOST_PP_IDENTITY(__stdcall ) ))\
+  (( PASCAL             , pascal_cc   , BOOST_PP_IDENTITY(pascal    ) ))\
+  (( FASTCALL           , fastcall_cc , BOOST_PP_IDENTITY(__fastcall) ))\
+  (( CLRCALL            , clrcall_cc  , BOOST_PP_IDENTITY(__clrcall ) ))\
+  (( THISCALL           , thiscall_cc , BOOST_PP_IDENTITY(__thiscall) ))\
+  (( IMPLICIT_THISCALL  , thiscall_cc , BOOST_PP_EMPTY                )) 
+// Don't get confused by the last line, here (thiscall can't be specified
+// explicitly prior to MSVC 8).
+
+
+
+ +

+ Enables a specific calling convention. * dentoes the macro suffix, as defined + by BOOST_FT_CC_NAMES + or BOOST_FT_BUILTIN_CC_NAMES. +

+

+ The macro expands to a list of restrictions, separated by the | + character. Possible items are: +

+
    +
  • + callable_builtin +
  • +
  • + member +
  • +
  • + non_member +
  • +
  • + variadic +
  • +
  • + non_variadic +
  • +
+

+ If no such macro is defined for a particular calling convention, it is + disabled. Example: +

+
+#define BOOST_FT_CC_STDCALL non_variadic|callable_builtin
+// enables stdcall calling convention for all non-variadic, 
+// callable, builtin types
+
+
+
+ +

+ Defining this macro causes the following macros to be defined, if not defined + already: +

+
+#define BOOST_FT_CC_CDECL BOOST_FT_COMMON_X86_CCs
+#define BOOST_FT_CC_STDCALL non_variadic|BOOST_FT_COMMON_X86_CCs
+#define BOOST_FT_CC_FASTCALL non_variadic|BOOST_FT_COMMON_X86_CCs
+
+
+
+ +

+ This macro allows to change the syntax of callable builtin types. It is + useful to handle the compiler specific placement of the calling convention + specifier. +

+

+ The default definition is as follows: +

+
+#define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \
+          result() lparen() cc_spec() type_mod() name() rparen()
+
+
+
+ +

+ Set to void for compilers that insist on a void + parameter for nullary function types, empty by default. +

+
+
+ +

+ Disables support for cv-qualified function types. Cv-qualified function + types are illegal by the current standard version, but there is a pending + defect report on that issue. It defaults to 1 until + the standard changes, setting this macro to 0 may not + work. +

+
+

+ The following macros are useful for testing when changing + the source code of the library. +

+
+ +

+ Makes the compiler preprocess as much as possible of the library code (rather + than loading already-preprocessed header files) if defined. +

+
+
+ +

+ Makes the compiler preprocess the loop over possible names for custom calling + conventions (rather than loading an already-preprocessed header file) if + defined. +

+

+ This macro is defined automatically if BOOST_FT_CC_NAMES + has been defined. +

+
+
+ + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_functiontypes/reference/synthesis.html b/doc/html/boost_functiontypes/reference/synthesis.html new file mode 100644 index 0000000..367db36 --- /dev/null +++ b/doc/html/boost_functiontypes/reference/synthesis.html @@ -0,0 +1,230 @@ + + + + Class templates + for type synthesis + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ + +
+ +
+template<typename Types, typename Tag = null_tag> 
+struct function_type;
+
+

+ Header +

+
+#include <boost/function_types/function_type.hpp>
+
+
+

+
+
Types
+

+ Component types in form of an MPL + - Forward + Sequence or another callable, builtin type +

+
Tag
+

+ Further properties +

+
function_type<Types,Tag>::type
+

+ Synthesized type +

+
+
+

+ Synthesizes a function type from given properties. +

+

+ If the template parameters do not describe a valid type, any attempt to + access the type member will result in a compile error. +

+
+
+ +
+template<typename Types, typename Tag = null_tag> 
+struct function_pointer;
+
+

+ Header +

+
+#include <boost/function_types/function_pointer.hpp>
+
+
+

+
+
Types
+

+ Component types in form of an MPL + - Forward + Sequence or another callable, builtin type +

+
Tag
+

+ Further properties +

+
function_pointer<Types,Tag>::type
+

+ Synthesized type +

+
+
+

+ Synthesizes a function pointer type from given properties. +

+

+ If the template parameters do not describe a valid type, any attempt to + access the type member will result in a compile error. +

+
+
+ +
+template<typename Types, typename Tag = null_tag> 
+struct function_reference;
+
+

+ Header +

+
+#include <boost/function_types/function_reference.hpp>
+
+
+

+
+
Types
+

+ Component types in form of an MPL + - Forward + Sequence or another callable, builtin type +

+
Tag
+

+ Further properties +

+
function_reference<Types,Tag>::type
+

+ Synthesized type +

+
+
+

+ Synthesizes a function reference type from given properties. +

+

+ If the template parameters do not describe a valid type, any attempt to + access the type member will result in a compile error. +

+
+
+ +
+template<typename Types, typename Tag = null_tag> 
+struct member_function_pointer;
+
+

+ Header +

+
+#include <boost/function_types/member_function_pointer.hpp>
+
+
+

+
+
Types
+

+ Component types in form of an MPL + - Forward + Sequence or another callable, builtin type +

+
Tag
+

+ Further properties +

+
member_function_pointer<Types,Tag>::type
+

+ Synthesized type +

+
+
+

+ Synthesizes a member function pointer type from given properties. +

+

+ An optional reference or possibly cv-qualified pointer is removed from + the second type in the sequence to determine the the class type. The cv-qualification + of the resulting type applies to the member function, unless otherwise + explicitly specified by the property tag. +

+

+ If the template parameters do not describe a valid type, any attempt to + access the type member will result in a compile error. +

+
+
+ + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_functiontypes/reference/tag_types.html b/doc/html/boost_functiontypes/reference/tag_types.html new file mode 100644 index 0000000..eb40aac --- /dev/null +++ b/doc/html/boost_functiontypes/reference/tag_types.html @@ -0,0 +1,320 @@ + + + + Tag Types + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ + +
+ +
+typedef unspecified variadic;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type takes a variable number of arguments through + an ellipsis parameter (such as printf). +

+
+
+ +
+typedef unspecified non_variadic;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type does not have an ellipsis parameter. +

+
+
+ +
+typedef unspecified default_cc;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type encodes the default calling convention. +

+
+
+ +
+typedef unspecified const_qualified;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type is const qualified. +

+
+
+ +
+typedef unspecified non_const;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type is not const qualified. +

+
+
+ +
+typedef unspecified volatile_qualified;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type is volatile qualified. +

+
+
+ +
+typedef unspecified non_volatile;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type is not volatile qualified. +

+
+
+ +
+typedef unspecified non_cv;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type is neither const nor volatile qualified. Equivalent + to __tag<__non_const,__non_volatile>, + but involves fewer template instantiations when evaluated. +

+
+
+ +
+typedef unspecified const_non_volatile;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type is const but not volatile qualified. Equivalent + to __tag<__const_qualified,__non_volatile>, + but involves fewer template instantiations when evaluated. +

+
+
+ +
+typedef unspecified volatile_non_const;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type is volatile but not const qualified. Equivalent + to __tag<__volatile_qualified,__non_const>, + but involves fewer template instantiations when evaluated. +

+
+
+ +
+typedef unspecified cv_qualified;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States that a function type is both const and volatile qualified. Equivalent + to __tag<__const_qualified,__volatile_qualified>, + but involves fewer template instantiations when evaluated. +

+
+
+ +
+typedef unspecified null_tag;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+

+ States nothing. +

+
+
+ +
+template<class Tag1, class Tag2, 
+    class Tag3 = null_tag, class Tag4 = null_tag>
+struct tag;
+
+

+ Header +

+
+#include <boost/function_types/property_tags.hpp>
+
+
+

+
+
TagN
+

+ Property tag +

+
tag<Tag1,Tag2...>
+

+ Compound property tag +

+
+
+

+ Combination of up to four property tags. If the arguments describe different + values for the same property the value of the rightmost argument is used. +

+
+
+ + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boost_functiontypes/use_cases.html b/doc/html/boost_functiontypes/use_cases.html new file mode 100644 index 0000000..ab9e332 --- /dev/null +++ b/doc/html/boost_functiontypes/use_cases.html @@ -0,0 +1,175 @@ + + + + Use Cases + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +

+ Generic libraries that accept callable arguments are common in C++. Accepting + a callable argument of builin type often involves a lot of repetitive code + because the accepting function is overloaded for different function arities. + Further, member functions may have const/volatile-qualifiers, + a function may take a variable number of (additional, POD-typed) arguments + (such as printf) and several C++ implementations encode + a calling convention with each function's type to allow calls across language + or (sub-)system boundaries. +

+
+template<typename R>
+void accept_function(R(* func)());
+
+template<typename R>
+void accept_function(R(& func)());
+
+template<typename R, typename C>
+void accept_function(R(C::* func)());
+
+template<typename R, typename C>
+void accept_function(R(C::* func)() const);
+
+template<typename R, typename C>
+void accept_function(R(C::* func)() volatile);
+
+template<typename R, typename C>
+void accept_function(R(C::* func)() const volatile);
+
+template<typename R>
+void accept_function(R(* func)(...));
+
+template<typename R>
+void accept_function(R(& func)(...));
+
+template<typename R, typename C>
+void accept_function(R(C::* func)(...));
+
+template<typename R, typename C>
+void accept_function(R(C::* func)(...) const);
+
+template<typename R, typename C>
+void accept_function(R(C::* func)(...) volatile);
+
+template<typename R, typename C>
+void accept_function(R(C::* func)(...) const volatile);
+
+// ...
+
+// needs to be repeated for every additional function parameter
+// times the number of possible calling conventions
+
+

+ The "overloading approach" obviously does not scale well: There might + be several functions that accept callable arguments in one library and client + code might end up using several libraries that use this pattern. On the developer + side, library developers spend their time solving the same problem, working + around the same portability issues, and apply similar optimizations to keep + the compilation time down. +

+

+ Using Boost.FunctionTypes it is possible to write a single function template + instead: +

+
+template<typename F>
+void accept_function(F f)
+{
+  // ... use Boost.FunctionTypes to analyse F
+}
+
+

+ The combination with a tuples library that provides an invoker component, such + as Boost.Fusion, allows to + build flexible callback facilities that are entirely free of repetitive code + as shown by the interpreter + example. +

+

+ When taking the address of an overloaded function or function template, the + type of the function must be known from the context the expression is used + in. The code below shows three examples for choosing the float(float) + overload of std::abs. +

+
+float (*ptr_absf)(float) = & std::abs;
+
+
+void foo(float(*func)(float));
+
+void bar() 
+{ 
+  foo(& std::abs); 
+}
+
+
+std::transform(b, e, o, static_cast<float(*)(float)>(& std::abs));
+
+

+ The library's type synthesis capabilities can be used to automate overload + selection and instantiation of function templates. Given an overloaded function + template +

+
+template<typename R, typename T0>
+R overloaded(T0);
+
+template<typename R, typename T0, typename T1>
+R overloaded(T0,T1);
+
+template<typename R. typename T0, typename T1, typename T2>
+R overloaded(T0,T1,T2);
+
+

+ we can pick any of the three overloads and instantiate the template with template + arguments from a type sequence in a single expression: +

+
+static_cast<function_pointer<Seq>::type>(& overloaded)
+
+

+ This technique can be occasionally more flexible than template argument deduction + from a function call because the exact types from the sequence are used to + specialize the template (including possibly cv-qualified reference types and + the result type). It is applied twice in the interface + example. +

+

+ Another interersting property of callable, builtin types is that they can be + valid types for non-type template parameters. This way, a function can be pinpointed + at compile time, allowing the compiler to eliminate the call by inlining. The + fast_mem_fn example + exploits this characteristic and implements a potentially inlining version + of boost::mem_fn limited to + member functions that are known at compile time. +

+
+ + + +
Copyright © 2004 -2007 Tobias Schwinger
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/boostbook.css b/doc/html/boostbook.css new file mode 100644 index 0000000..858d43c --- /dev/null +++ b/doc/html/boostbook.css @@ -0,0 +1,528 @@ +/*============================================================================= + Copyright (c) 2004 Joel de Guzman + http://spirit.sourceforge.net/ + + 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) +=============================================================================*/ + +/*============================================================================= + Body defaults +=============================================================================*/ + + body + { + margin: 1em; + font-family: sans-serif; + } + +/*============================================================================= + Paragraphs +=============================================================================*/ + + p + { + text-align: left; + font-size: 10pt; + line-height: 1.15; + } + +/*============================================================================= + Program listings +=============================================================================*/ + + /* Code on paragraphs */ + p tt.computeroutput + { + font-size: 9pt; + } + + pre.synopsis + { + font-size: 90%; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + .programlisting, + .screen + { + font-size: 9pt; + display: block; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } + + /* Program listings in tables don't get borders */ + td .programlisting, + td .screen + { + margin: 0pc 0pc 0pc 0pc; + padding: 0pc 0pc 0pc 0pc; + } + +/*============================================================================= + Headings +=============================================================================*/ + + h1, h2, h3, h4, h5, h6 + { + text-align: left; + margin: 1em 0em 0.5em 0em; + font-weight: bold; + } + + h1 { font: 140% } + h2 { font: bold 140% } + h3 { font: bold 130% } + h4 { font: bold 120% } + h5 { font: italic 110% } + h6 { font: italic 100% } + + /* Top page titles */ + title, + h1.title, + h2.title + h3.title, + h4.title, + h5.title, + h6.title, + .refentrytitle + { + font-weight: bold; + margin-bottom: 1pc; + } + + h1.title { font-size: 140% } + h2.title { font-size: 140% } + h3.title { font-size: 130% } + h4.title { font-size: 120% } + h5.title { font-size: 110% } + h6.title { font-size: 100% } + + .section h1 + { + margin: 0em 0em 0.5em 0em; + font-size: 140%; + } + + .section h2 { font-size: 140% } + .section h3 { font-size: 130% } + .section h4 { font-size: 120% } + .section h5 { font-size: 110% } + .section h6 { font-size: 100% } + + /* Code on titles */ + h1 tt.computeroutput { font-size: 140% } + h2 tt.computeroutput { font-size: 140% } + h3 tt.computeroutput { font-size: 130% } + h4 tt.computeroutput { font-size: 120% } + h5 tt.computeroutput { font-size: 110% } + h6 tt.computeroutput { font-size: 100% } + +/*============================================================================= + Author +=============================================================================*/ + + h3.author + { + font-size: 100% + } + +/*============================================================================= + Lists +=============================================================================*/ + + li + { + font-size: 10pt; + line-height: 1.3; + } + + /* Unordered lists */ + ul + { + text-align: left; + } + + /* Ordered lists */ + ol + { + text-align: left; + } + +/*============================================================================= + Links +=============================================================================*/ + + a + { + text-decoration: none; /* no underline */ + } + + a:hover + { + text-decoration: underline; + } + +/*============================================================================= + Spirit style navigation +=============================================================================*/ + + .spirit-nav + { + text-align: right; + } + + .spirit-nav a + { + color: white; + padding-left: 0.5em; + } + + .spirit-nav img + { + border-width: 0px; + } + +/*============================================================================= + Table of contents +=============================================================================*/ + + .toc + { + margin: 1pc 4% 0pc 4%; + padding: 0.1pc 1pc 0.1pc 1pc; + font-size: 80%; + line-height: 1.15; + } + + .boost-toc + { + float: right; + padding: 0.5pc; + } + +/*============================================================================= + Tables +=============================================================================*/ + + .table-title, + div.table p.title + { + margin-left: 4%; + padding-right: 0.5em; + padding-left: 0.5em; + } + + .informaltable table, + .table table + { + width: 92%; + margin-left: 4%; + margin-right: 4%; + } + + div.informaltable table, + div.table table + { + padding: 4px; + } + + /* Table Cells */ + div.informaltable table tr td, + div.table table tr td + { + padding: 0.5em; + text-align: left; + font-size: 9pt; + } + + div.informaltable table tr th, + div.table table tr th + { + padding: 0.5em 0.5em 0.5em 0.5em; + border: 1pt solid white; + font-size: 80%; + } + +/*============================================================================= + Blurbs +=============================================================================*/ + + div.note, + div.tip, + div.important, + div.caution, + div.warning, + div.sidebar + { + font-size: 9pt; /* A little bit smaller than the main text */ + line-height: 1.2; + display: block; + margin: 1pc 4% 0pc 4%; + padding: 0.5pc 0.5pc 0.0pc 0.5pc; + } + + div.sidebar img + { + padding: 1pt; + } + +/*============================================================================= + Callouts +=============================================================================*/ + .line_callout_bug img + { + float: left; + position:relative; + left: 4px; + top: -12px; + clear: left; + margin-left:-22px; + } + + .callout_bug img + { + } + +/*============================================================================= + Variable Lists +=============================================================================*/ + + /* Make the terms in definition lists bold */ + div.variablelist dl dt, + span.term + { + font-weight: bold; + font-size: 10pt; + } + + div.variablelist table tbody tr td + { + text-align: left; + vertical-align: top; + padding: 0em 2em 0em 0em; + font-size: 10pt; + margin: 0em 0em 0.5em 0em; + line-height: 1; + } + + div.variablelist dl dt + { + margin-bottom: 0.2em; + } + + div.variablelist dl dd + { + margin: 0em 0em 0.5em 2em; + font-size: 10pt; + } + + div.variablelist table tbody tr td p, + div.variablelist dl dd p + { + margin: 0em 0em 0.5em 0em; + line-height: 1; + } + +/*============================================================================= + Misc +=============================================================================*/ + + /* Title of books and articles in bibliographies */ + span.title + { + font-style: italic; + } + + span.underline + { + text-decoration: underline; + } + + span.strikethrough + { + text-decoration: line-through; + } + + /* Copyright, Legal Notice */ + div div.legalnotice p + { + text-align: left + } + +/*============================================================================= + Colors +=============================================================================*/ + + @media screen + { + /* Links */ + a + { + color: #005a9c; + } + + a:visited + { + color: #9c5a9c; + } + + h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, + h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover, + h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited + { + text-decoration: none; /* no underline */ + color: #000000; + } + + /* Syntax Highlighting */ + .keyword { color: #0000AA; } + .identifier { color: #000000; } + .special { color: #707070; } + .preprocessor { color: #402080; } + .char { color: teal; } + .comment { color: #800000; } + .string { color: teal; } + .number { color: teal; } + .white_bkd { background-color: #FFFFFF; } + .dk_grey_bkd { background-color: #999999; } + + /* Copyright, Legal Notice */ + .copyright + { + color: #666666; + font-size: small; + } + + div div.legalnotice p + { + color: #666666; + } + + /* Program listing */ + pre.synopsis + { + border: 1px solid #DCDCDC; + } + + .programlisting, + .screen + { + border: 1px solid #DCDCDC; + } + + td .programlisting, + td .screen + { + border: 0px solid #DCDCDC; + } + + /* Blurbs */ + div.note, + div.tip, + div.important, + div.caution, + div.warning, + div.sidebar + { + border: 1px solid #DCDCDC; + } + + /* Table of contents */ + .toc + { + border: 1px solid #DCDCDC; + } + + /* Tables */ + div.informaltable table tr td, + div.table table tr td + { + border: 1px solid #DCDCDC; + } + + div.informaltable table tr th, + div.table table tr th + { + background-color: #F0F0F0; + border: 1px solid #DCDCDC; + } + + /* Misc */ + span.highlight + { + color: #00A000; + } + } + + @media print + { + /* Links */ + a + { + color: black; + } + + a:visited + { + color: black; + } + + .spirit-nav + { + display: none; + } + + /* Program listing */ + pre.synopsis + { + border: 1px solid gray; + } + + .programlisting, + .screen + { + border: 1px solid gray; + } + + td .programlisting, + td .screen + { + border: 0px solid #DCDCDC; + } + + /* Table of contents */ + .toc + { + border: 1px solid gray; + } + + .informaltable table, + .table table + { + border: 1px solid gray; + border-collapse: collapse; + } + + /* Tables */ + div.informaltable table tr td, + div.table table tr td + { + border: 1px solid gray; + } + + div.informaltable table tr th, + div.table table tr th + { + border: 1px solid gray; + } + + /* Misc */ + span.highlight + { + font-weight: bold; + } + } diff --git a/doc/html/index.html b/doc/html/index.html new file mode 100644 index 0000000..358b001 --- /dev/null +++ b/doc/html/index.html @@ -0,0 +1,55 @@ + + + +Chapter 1. Boost.FunctionTypes 2.5 + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
Next
+
+
+

+Chapter 1. Boost.FunctionTypes 2.5

+

+Tobias Schwinger +

+
+
+

+ 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) +

+
+
+ +
+ + + +

Last revised: May 13, 2007 at 13:12:48 GMT

+
+
Next
+ + diff --git a/example/Jamfile b/example/Jamfile new file mode 100644 index 0000000..08ab43d --- /dev/null +++ b/example/Jamfile @@ -0,0 +1,20 @@ + +# (C) Copyright Tobias Schwinger +# +# Use, modification and distribution are subject to the Boost Software License, +# Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +#------------------------------------------------------------------------------- + +exe interpreter_example : interpreter_example.cpp ; + +exe result_of_example : result_of_example.cpp ; + +exe interface_example : interface_example.cpp ; + +exe fast_mem_fn_example : fast_mem_fn_example.cpp + : . ; # needed for Boost.PP file iteration with some compilers + +exe macro_type_args_example : macro_type_args_example.cpp ; + + diff --git a/example/detail/param_type.hpp b/example/detail/param_type.hpp new file mode 100644 index 0000000..7c0fd5f --- /dev/null +++ b/example/detail/param_type.hpp @@ -0,0 +1,71 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// Metafunction to compute optimal parameter type for argument forwarding. + +// This header is not an FT example in itself -- it's used by some of them to +// optimize argument forwarding. +// +// For more details see 'fast_mem_fn.hpp' in this directory or the documentation +// of the CallTraits utility [1]. +// +// +// References +// ========== +// +// [1] http://www.boost.org/libs/utility/call_traits.htm + +#ifndef BOOST_UTILITY_PARAM_TYPE_HPP_INCLUDED +#define BOOST_UTILITY_PARAM_TYPE_HPP_INCLUDED + +#include + +#include +#include + +#include +#include + +#include +// #include + +// namespace boost +namespace example +{ + namespace mpl = boost::mpl; + + // namespace utility + // { + namespace param_type_detail + { + template + struct by_ref_cond + { + typedef by_ref_cond type; + BOOST_STATIC_CONSTANT(bool,value = sizeof(void*) < sizeof(T)); + }; + + template + struct add_ref_to_const + : boost::add_reference< typename boost::add_const::type > + { }; + } + + template + struct param_type + : mpl::eval_if< param_type_detail::by_ref_cond + , param_type_detail::add_ref_to_const, mpl::identity > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,param_type,(T)) + }; + // } + // BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,utility::param_type) +} + +#endif + diff --git a/example/fast_mem_fn.hpp b/example/fast_mem_fn.hpp new file mode 100644 index 0000000..97f95b0 --- /dev/null +++ b/example/fast_mem_fn.hpp @@ -0,0 +1,248 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ +// +// This example implements a very efficient, generic member function wrapper. +// +// +// Detailed description +// ==================== +// +// For most platforms C++ runs on (maybe all hardware platforms, as opposed to +// virtual machines) there are indirect calls that take more time to execute +// than direct ones. Further calling a function usually takes more time than +// inlining it at the call site. +// +// A direct call is a machine instruction that calls a subroutine at a known +// address encoded in the instruction itself. C++ compilers usually emit one of +// these instructions for each function call to a nonvirtual function (a call to +// a virtual function requires either two direct calls or one indirect call). +// An indirect call is a machine instruction that calls a subroutine at an +// address known at runtime. C++ compilers usually emit at least one of these +// instructions for a call through a callable builtin variable. +// +// It is possible to use callable scalars as non-type template arguments. This +// way the compiler knows which function we want to call when generating the +// code for the call site, so it may inline (if it decides to do so) or use a +// direct call instead of being forced to use a slow, indirect call. +// +// We define a functor class template that encodes the function to call in its +// type via a non-type template argument. Its (inline declared) overloaded +// function call operator calls the function through that non-type template +// argument. In the best case we end up inlining the callee directly at the +// point of the call. +// +// Decomposition of the wrapped member function's type is needed in order to +// implement argument forwarding (just using a templated call operator we would +// encounter what is known as "the forwarding problem" [Dimov1]). Further we +// can eliminate unecessary copies for each by-value parameter by using a +// reference to its const qualified type for the corresponding parameter of the +// wrapper's function call operator. +// +// Finally we provide a macro that does have similar semantics to the function +// template mem_fn of the Bind [2] library. +// We can't use a function template and use a macro instead, because we use a +// member function pointer that is a compile time constant. So we first have to +// deduce the type and create a template that accepts this type as a non-type +// template argument, which is passed in in a second step. The macro hides this +// lengthy expression from the user. +// +// +// Limitations +// =========== +// +// The "this-argument" must be specified as a reference. +// +// +// Bibliography +// ============ +// +// [Dimov1] Dimov, P., Hinnant H., Abrahams, D. The Forwarding Problem +// http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm +// +// [Dimov2] Dimov, P. Documentation of boost::mem_fn +// http://www.boost.org/libs/bind/mem_fn.html + +#ifndef BOOST_EXAMPLE_FAST_MEM_FN_HPP_INCLUDED +#ifndef BOOST_PP_IS_ITERATING + + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "detail/param_type.hpp" + +namespace example +{ + + namespace ft = boost::function_types; + namespace mpl = boost::mpl; + using namespace mpl::placeholders; + + // the functor class template + template< typename MFPT, MFPT MemberFunction + , size_t Arity = ::example::ft::function_arity::value + > + struct fast_mem_fn; + + // ------- ---- --- -- - - - - + + // deduce type and capture compile time value + #define BOOST_EXAMPLE_FAST_MEM_FN(mfp) \ + ::example::make_fast_mem_fn(mfp).make_fast_mem_fn() + + template + struct fast_mem_fn_maker + { + template + fast_mem_fn make_fast_mem_fn() + { + return fast_mem_fn(); + } + }; + + template + typename boost::enable_if, + fast_mem_fn_maker >::type + make_fast_mem_fn(MFPT) + { + return fast_mem_fn_maker(); + } + + + // ------- ---- --- -- - - - - + + namespace detail + { + // by-value forwarding optimization + template + struct parameter_types + : mpl::transform_view,param_type<_> > + { }; + } + + // ------- ---- --- -- - - - - + + template< typename MFPT, MFPT MemberFunction > + struct fast_mem_fn + { + // decompose the result and the parameter types (public for introspection) + typedef typename ft::result_type::type result_type; + typedef detail::parameter_types parameter_types; + private: + // iterate the parameter types + typedef typename mpl::begin::type i0; + public: + // forwarding function call operator + result_type operator()( typename mpl::deref::type a0) const + { + return (a0.*MemberFunction)(); + }; + }; + + template< typename MFPT, MFPT MemberFunction > + struct fast_mem_fn + { + // decompose the result and the parameter types (public for introspection) + typedef typename ft::result_type::type result_type; + typedef detail::parameter_types parameter_types; + private: + // iterate the parameter types + typedef typename mpl::begin::type i0; + typedef typename mpl::next::type i1; + public: + // forwarding function call operator + result_type operator()( typename mpl::deref::type a0 + , typename mpl::deref::type a1) const + { + return (a0.*MemberFunction)(a1); + }; + }; + + template< typename MFPT, MFPT MemberFunction > + struct fast_mem_fn + { + // decompose the result and the parameter types (public for introspection) + typedef typename ft::result_type::type result_type; + typedef detail::parameter_types parameter_types; + private: + // iterate the parameter types + typedef typename mpl::begin::type i0; + typedef typename mpl::next::type i1; + typedef typename mpl::next::type i2; + public: + // forwarding function call operator + result_type operator()( typename mpl::deref::type a0 + , typename mpl::deref::type a1 + , typename mpl::deref::type a2) const + { + return (a0.*MemberFunction)(a1,a2); + }; + }; + + // ... +} + +// ------- ---- --- -- - - - - + +// preprocessor-based code generator to continue the repetitive part, above + +#include +#include +#include +#include +#include +#include + +namespace example +{ + #if BOOST_FT_MAX_ARITY >= 4 + # define BOOST_PP_FILENAME_1 "fast_mem_fn.hpp" + # define BOOST_PP_ITERATION_LIMITS (4,BOOST_FT_MAX_ARITY) + # include BOOST_PP_ITERATE() + #endif +} + +#define BOOST_EXAMPLE_FAST_MEM_FN_HPP_INCLUDED +#else + + #define N BOOST_PP_FRAME_ITERATION(1) + template< typename MFPT, MFPT MemberFunction > + struct fast_mem_fn + { + // decompose the result and the parameter types (public for introspection) + typedef typename ft::result_type::type result_type; + typedef detail::parameter_types parameter_types; + private: + // iterate the parameter types + typedef typename mpl::begin::type i0; + #define BOOST_PP_LOCAL_LIMITS (0,N-2) + #define BOOST_PP_LOCAL_MACRO(j) \ + typedef typename mpl::next< i ## j >::type BOOST_PP_CAT(i,BOOST_PP_INC(j)) ; + #include BOOST_PP_LOCAL_ITERATE() + public: + // forwarding function call operator + result_type operator()( + BOOST_PP_ENUM_BINARY_PARAMS(N, typename mpl::deref::type a) ) const + { + return (a0.*MemberFunction)(BOOST_PP_ENUM_SHIFTED_PARAMS(N,a)); + }; + }; + #undef N + +#endif +#endif + diff --git a/example/fast_mem_fn_example.cpp b/example/fast_mem_fn_example.cpp new file mode 100644 index 0000000..efe66a1 --- /dev/null +++ b/example/fast_mem_fn_example.cpp @@ -0,0 +1,118 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ +// See fast_mem_fn.hpp in this directory for details. + +#include +#include +#include +#include +#include + +#include +#include + +#include "fast_mem_fn.hpp" + +// test class that holds a single integer with getter function +class test +{ + int val_id; +public: + + explicit test(int id) + : val_id(id) + { } + + int id() const + { return val_id; } + +}; + +// STL style comparator that applies the CriterionExtractor function to both +// operands and compares the results with Comparator +template +class test_compare +{ + CriterionExtractor fnc_criterion; + Comparator fnc_compare; +public: + + explicit test_compare(CriterionExtractor criterion, Comparator compare) + : fnc_criterion(criterion) + , fnc_compare(compare) + { } + + template + inline bool operator()(T const & lhs, T const & rhs) const + { + return fnc_compare(fnc_criterion(lhs),fnc_criterion(rhs)); + } +}; + +// helper function to construct an instance of the test_compare comparator. +template +test_compare +make_test_compare(CriterionExtractor criterion, Comparator compare) +{ + return test_compare(criterion,compare); +} + +// the test case: sort N test objects by id +// +// the objects are in ascending order before the test run and in descending +// order after it + +static const unsigned N = 2000000; + +typedef std::vector test_vector; + + +void setup_test(test_vector & v) +{ + v.clear(); + v.reserve(N); + for (unsigned i = 0; i < N; ++i) + v.push_back(test(i)); +} + +template void do_test(test_vector & v, F criterion) +{ + std::sort(v.begin(),v.end(),make_test_compare(criterion,std::greater())); + assert(v.begin()->id() == N-1); +} + + +// compare performance with boost::mem_fn +int main() +{ + test_vector v; + boost::timer t; + double time1, time2; + + std::cout << + "Test case: sorting " << N << " objects.\n\n" + "Criterion accessor called with | elasped seconds\n" + "-------------------------------|----------------" << std::endl; + + setup_test(v); + t.restart(); + do_test(v, BOOST_EXAMPLE_FAST_MEM_FN(& test::id)); + time1 = t.elapsed(); + std::cout << "fast_mem_fn | " << time1 << std::endl; + + setup_test(v); + t.restart(); + do_test(v, boost::mem_fn(& test::id)); + time2 = t.elapsed(); + std::cout << "mem_fn | " << time2 << std::endl; + + std::cout << '\n' << (time2/time1-1)*100 << "% speedup" << std::endl; + + return 0; +} + diff --git a/example/interface.hpp b/example/interface.hpp new file mode 100644 index 0000000..cadf740 --- /dev/null +++ b/example/interface.hpp @@ -0,0 +1,361 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ +// +// This example implements interfaces. +// +// Detailed description +// ==================== +// +// An interface is a collection of member function prototypes that may be +// implemented by classes. Objects of classes that implement the interface can +// then be assigned to an interface variable through which the interface's +// functions can be called. +// +// Interfaces are a feature of the Java programming language [Gosling] and the +// most obvious way to model interfaces in C++ is (multiple) inheritance. +// Using inheritance for this purpose, however, is neither the most efficient +// nor the most flexible solution, because: +// +// - all functions must be virtual, +// +// => a function that calls another function of the interface must do so +// via virtual dispatch (as opposed to inlining) +// => a class can not implement an interface's (overloaded) function via +// a function template +// +// - inhertitance is intrusive +// +// => object size increases +// => client's are always polymorphic +// => dependencies cause tighter coupling +// +// Fortunately it is possible to eliminate all the drawbacks mentioned above +// based on an alternative implementation proposed by David Abrahams. +// We'll add some detail to the original scheme (see [Abrahams]) such as +// support for overloaded and const qualified functions. +// The implementation in this example uses Boost.FunctionTypes to shift +// metaprogramming code from the preprocessor into templates, to reduce +// preprocessing time and increase maintainability. +// +// +// Limitations +// =========== +// +// There is no lifetime management as implemented by the Boost candidate +// Interfaces library (see [Turkanis]). +// +// This example does not compile with Visual C++. Template argument deduction +// from the result of the address-of operator does not work properly with this +// compiler. It is possible to partially work around the problem, but it isn't +// done here for the sake of readability. +// +// +// Bibliography +// ============ +// +// [Gosling] Gosling, J., Joy, B., Steele, G. The Java Language Specification +// http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html +// +// [Abrahams] Abrahams, D. Proposal: interfaces, Post to newsgroup comp.std.c++ +// http://groups.google.com/group/comp.std.c++/msg/85af30a61bf677e4 +// +// [Turkanis] Turkanis, J., Diggins, C. Boost candidate Interfaces library +// http://www.kangaroologic.com/interfaces/libs/interfaces/doc/index.html + +#include + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "detail/param_type.hpp" + +namespace example +{ + namespace ft = boost::function_types; + namespace mpl = boost::mpl; + using namespace mpl::placeholders; + + // join a single type and an MPL-sequence + // in some ways similar to mpl::push_front (but mpl::push_front requires + // an MPL Extensible Sequence and this template does not) + template + struct concat_view + : mpl::joint_view, Seq> + { }; + + // metafunction returning a function pointer type for a vtable entry + template + struct vtable_entry + : ft::function_pointer + < concat_view< typename Inf::result, mpl::transform_view< + typename Inf::params, param_type<_> > > > + { }; + + // the expression '& member::wrap<& Class::Function> ' in an + // assignment context binds the member function Function of Class with the + // properties described by MetaInfo and Tag to the corresponding vtable + // entry + template + struct member + { + typedef typename ft::member_function_pointer + < concat_view,Tag + >::type + mem_func_ptr; + + typedef typename mpl::at_c::type context; + + template + static typename Inf::result wrap(void* c) + { + return (reinterpret_cast(c)->*MemFuncPtr)(); + } + template + static typename Inf::result wrap(void* c, T0 a0) + { + return (reinterpret_cast(c)->*MemFuncPtr)(a0); + } + template + static typename Inf::result wrap(void* c, T0 a0, T1 a1) + { + return (reinterpret_cast(c)->*MemFuncPtr)(a0,a1); + } + // continue with the preprocessor (the scheme should be clear, by now) + #define BOOST_PP_LOCAL_MACRO(n) \ + template \ + static typename Inf::result wrap(void* c, \ + BOOST_PP_ENUM_BINARY_PARAMS(n,T,a)) \ + { \ + return (reinterpret_cast(c)->*MemFuncPtr)( \ + BOOST_PP_ENUM_PARAMS(n,a) ); \ + } + #define BOOST_PP_LOCAL_LIMITS (3,BOOST_FT_MAX_ARITY-1) + #include BOOST_PP_LOCAL_ITERATE() + }; + + // extract a parameter by index + template + struct param + : param_type< typename mpl::at_c< typename Inf::params,Index>::type > + { }; +} + +// the interface definition on the client's side +#define BOOST_EXAMPLE_INTERFACE(name,def) \ + class name \ + { \ + struct vtable \ + { \ + BOOST_EXAMPLE_INTERFACE__MEMBERS(def,VTABLE) \ + }; \ + \ + vtable const * ptr_vtable; \ + void * ptr_that; \ + \ + template struct vtable_holder \ + { \ + static vtable const val_vtable; \ + }; \ + \ + public: \ + \ + template \ + inline name (T & that) \ + : ptr_vtable(& vtable_holder::val_vtable) \ + , ptr_that(boost::addressof(that)) \ + { } \ + \ + BOOST_EXAMPLE_INTERFACE__MEMBERS(def,FUNCTION) \ + }; \ + \ + template \ + name ::vtable const name ::vtable_holder::val_vtable \ + = { BOOST_EXAMPLE_INTERFACE__MEMBERS(def,INIT_VTABLE) } + + +#ifdef BOOST_PP_NIL // never defined -- a comment with syntax highlighting + +BOOST_EXAMPLE_INTERFACE( interface_x, + (( a_func, (void)(int), const_qualified )) + (( another_func, (int), non_const )) +); + +// expands to: +class interface_x +{ + struct vtable + { + // meta information for first function + template struct inf0 + { + typedef void result; + typedef ::boost::mpl::vector< T, int > params; + }; + // function pointer with void* context pointer and parameters optimized + // for forwarding + ::example::vtable_entry >::type func0; + + // second function + template struct inf1 + { + typedef int result; + typedef ::boost::mpl::vector< T > params; + }; + ::example::vtable_entry >::type func1; + }; + + // data members + vtable const * ptr_vtable; + void * ptr_that; + + // this template is instantiated for every class T this interface is created + // from, causing the compiler to emit an initialized vtable for this type + // (see aggregate assignment, below) + template struct vtable_holder + { + static vtable const val_vtable; + }; + +public: + + // converting ctor, creates an interface from an arbitrary class + template + inline interface_x (T & that) + : ptr_vtable(& vtable_holder::val_vtable) + , ptr_that(boost::addressof(that)) + { } + + // the member functions from the interface definition, parameters are + // optimized for forwarding + + inline vtable::inf0<> ::result a_func ( + ::example::param,1>::type p0) const + { + return ptr_vtable-> func0(ptr_that , p0); + } + + inline vtable::inf1<> ::result another_func () + { + return ptr_vtable-> func1(ptr_that ); + } +}; + +template +interface_x ::vtable const interface_x ::vtable_holder::val_vtable = +{ + // instantiate function templates that wrap member function pointers (which + // are known at compile time) by taking their addresses in assignment to + // function pointer context + & ::example::member< vtable::inf0, ::example::ft:: const_qualified > + ::template wrap < &T:: a_func > +, & ::example::member< vtable::inf1, ::example::ft:: non_const > + ::template wrap < &T:: another_func > +}; +#endif + +// preprocessing code details + +// iterate all of the interface's members and invoke a macro (prefixed with +// BOOST_EXAMPLE_INTERFACE_) +#define BOOST_EXAMPLE_INTERFACE__MEMBERS(seq,macro) \ + BOOST_PP_REPEAT(BOOST_PP_SEQ_SIZE(seq), \ + BOOST_EXAMPLE_INTERFACE__ ## macro,seq) + +// extract signature sequence from entry +#define BOOST_EXAMPLE_INTERFACE__VTABLE(z,i,seq) \ + BOOST_EXAMPLE_INTERFACE__VTABLE_I(z,i, \ + BOOST_PP_TUPLE_ELEM(3,1,BOOST_PP_SEQ_ELEM(i,seq))) + +// split the signature sequence result/params and insert T at the beginning of +// the params part +#define BOOST_EXAMPLE_INTERFACE__VTABLE_I(z,i,seq) \ + BOOST_EXAMPLE_INTERFACE__VTABLE_II(z,i, \ + BOOST_PP_SEQ_HEAD(seq),(T)BOOST_PP_SEQ_TAIL(seq)) + +// emit the meta information structure and function pointer declaration +#define BOOST_EXAMPLE_INTERFACE__VTABLE_II(z,i,result_type,param_types) \ + template \ + struct BOOST_PP_CAT(inf,i) \ + { \ + typedef result_type result; \ + typedef ::boost::mpl::vector< BOOST_PP_SEQ_ENUM(param_types) > params; \ + }; \ + ::example::vtable_entry >::type BOOST_PP_CAT(func,i); + +// extract tuple entry from sequence and precalculate the name of the function +// pointer variable +#define BOOST_EXAMPLE_INTERFACE__INIT_VTABLE(z,i,seq) \ + BOOST_EXAMPLE_INTERFACE__INIT_VTABLE_I(i,seq,BOOST_PP_CAT(func,i), \ + BOOST_PP_SEQ_ELEM(i,seq)) + +// emit a function pointer expression that encapsulates the corresponding +// member function of T +#define BOOST_EXAMPLE_INTERFACE__INIT_VTABLE_I(i,seq,func,desc) \ + BOOST_PP_COMMA_IF(i) & ::example::member< BOOST_PP_CAT(vtable::inf,i), \ + ::example::ft:: BOOST_PP_TUPLE_ELEM(3,2,desc) >::template wrap \ + < &T:: BOOST_PP_TUPLE_ELEM(3,0,desc) > + +// extract tuple entry from sequence +#define BOOST_EXAMPLE_INTERFACE__FUNCTION(z,i,seq) \ + BOOST_EXAMPLE_INTERFACE__FUNCTION_I(z,i,BOOST_PP_SEQ_ELEM(i,seq)) + +// precalculate function name, arity, name of meta info structure and cv- +// qualifiers +#define BOOST_EXAMPLE_INTERFACE__FUNCTION_I(z,i,desc) \ + BOOST_EXAMPLE_INTERFACE__FUNCTION_II(z,i, \ + BOOST_PP_TUPLE_ELEM(3,0,desc), \ + BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(3,1,desc))), \ + BOOST_PP_CAT(vtable::inf,i)<>, \ + BOOST_PP_CAT(BOOST_EXAMPLE_INTERFACE___,BOOST_PP_TUPLE_ELEM(3,2,desc)) \ + ) + +// emit the definition for a member function of the interface +#define BOOST_EXAMPLE_INTERFACE__FUNCTION_II(z,i,name,arity,types,cv) \ + inline types ::result name \ + (BOOST_PP_ENUM_ ## z (arity,BOOST_EXAMPLE_INTERFACE__PARAM,types)) cv() \ + { \ + return ptr_vtable-> BOOST_PP_CAT(func,i)(ptr_that \ + BOOST_PP_ENUM_TRAILING_PARAMS_Z(z,arity,p)); \ + } + +// emit a parameter of the function definition +#define BOOST_EXAMPLE_INTERFACE__PARAM(z,j,types) \ + ::example::param::type BOOST_PP_CAT(p,j) + +// helper macros to map 'const_qualified' to 'const' an 'non_const' to '' +#define BOOST_EXAMPLE_INTERFACE___const_qualified BOOST_PP_IDENTITY(const) +#define BOOST_EXAMPLE_INTERFACE___non_const BOOST_PP_EMPTY + + diff --git a/example/interface_example.cpp b/example/interface_example.cpp new file mode 100644 index 0000000..d4f66bb --- /dev/null +++ b/example/interface_example.cpp @@ -0,0 +1,79 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ +// See interface.hpp in this directory for details. + +#include + +#include "interface.hpp" + + +BOOST_EXAMPLE_INTERFACE( interface_x, + (( a_func, (void)(int) , const_qualified )) + (( a_func, (void)(long), const_qualified )) + (( another_func, (int) , non_const )) +); + + +// two classes that implement interface_x + +struct a_class +{ + void a_func(int v) const + { + std::cout << "a_class::void a_func(int v = " << v << ")" << std::endl; + } + + void a_func(long v) const + { + std::cout << "a_class::void a_func(long v = " << v << ")" << std::endl; + } + + int another_func() + { + std::cout << "a_class::another_func() = 3" << std::endl; + return 3; + } +}; + +struct another_class +{ + // note: overloaded a_func implemented as a function template + template + void a_func(T v) const + { + std::cout << + "another_class::void a_func(T v = " << v << ")" + " [ T = " << typeid(T).name() << " ]" << std::endl; + } + + int another_func() + { + std::cout << "another_class::another_func() = 5" << std::endl; + return 5; + } +}; + + +// both classes above can be assigned to the interface variable and their +// member functions can be called through it +int main() +{ + a_class x; + another_class y; + + interface_x i(x); + i.a_func(12); + i.a_func(77L); + i.another_func(); + + i = y; + i.a_func(13); + i.a_func(21L); + i.another_func(); +} + diff --git a/example/interpreter.hpp b/example/interpreter.hpp new file mode 100644 index 0000000..9e75bf7 --- /dev/null +++ b/example/interpreter.hpp @@ -0,0 +1,188 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ +// +// This example implements a simple batch-style interpreter that is capable of +// calling functions previously registered with it. The parameter types of the +// functions are used to control the parsing of the input. +// +// Implementation description +// ========================== +// +// When a function is registered, an 'invoker' template is instantiated with +// the function's type. The 'invoker' fetches a value from the 'token_parser' +// for each parameter of the function into a tuple and finally invokes the the +// function with these values as arguments. The invoker's entrypoint, which +// is a function of the callable builtin that describes the function to call and +// a reference to the 'token_parser', is partially bound to the registered +// function and put into a map so it can be found by name during parsing. + +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +namespace example +{ + namespace fusion = boost::fusion; + namespace ft = boost::function_types; + namespace mpl = boost::mpl; + + class interpreter + { + class token_parser; + typedef boost::function invoker_function; + typedef std::map dictionary; + + dictionary map_invokers; + public: + // Registers a function with the interpreter. + template + typename boost::enable_if< ft::is_nonmember_callable_builtin + >::type register_function(std::string const & name, Function f); + + // Parse input for functions to call. + void parse_input(std::string const & text) const; + + private: + template< typename Function + , class From = typename mpl::begin< ft::parameter_types >::type + , class To = typename mpl::end< ft::parameter_types >::type + > + struct invoker; + }; + + class interpreter::token_parser + { + typedef boost::token_iterator_generator< + boost::char_separator >::type token_iterator; + + token_iterator itr_at, itr_to; + public: + + token_parser(token_iterator from, token_iterator to) + : itr_at(from), itr_to(to) + { } + + private: + template + struct remove_cv_ref + : boost::remove_cv< typename boost::remove_reference::type > + { }; + public: + // Returns a token of given type. + // We just apply boost::lexical_cast to whitespace separated string tokens + // for simplicity. + template + typename remove_cv_ref::type get() + { + if (! this->has_more_tokens()) + throw std::runtime_error("unexpected end of input"); + + try + { + typedef typename remove_cv_ref::type result_type; + result_type result = boost::lexical_cast + ::type>(*this->itr_at); + ++this->itr_at; + return result; + } + + catch (boost::bad_lexical_cast &) + { throw std::runtime_error("invalid argument: " + *this->itr_at); } + } + + // Any more tokens? + bool has_more_tokens() const { return this->itr_at != this->itr_to; } + }; + + template + struct interpreter::invoker + { + // add an argument to a Fusion cons-list for each parameter type + template + static inline + void apply(Function func, token_parser & parser, Args const & args) + { + typedef typename mpl::deref::type arg_type; + + invoker::type, To>::apply + ( func, parser, fusion::push_back(args, parser.get()) ); + } + }; + + template + struct interpreter::invoker + { + // the argument list is complete, now call the function + template + static inline + void apply(Function func, token_parser &, Args const & args) + { + fusion::invoke(func,args); + } + }; + + template + typename boost::enable_if< ft::is_nonmember_callable_builtin >::type + interpreter::register_function(std::string const & name, Function f) + { + // instantiate and store the invoker by name + this->map_invokers[name] = boost::bind( + & invoker::template apply, f,_1,fusion::nil() ); + } + + + void interpreter::parse_input(std::string const & text) const + { + boost::char_separator s(" \t\n\r"); + + token_parser parser + ( boost::make_token_iterator(text.begin(), text.end(), s) + , boost::make_token_iterator(text.end() , text.end(), s) ); + + while (parser.has_more_tokens()) + { + // read function name + std::string func_name = parser.get(); + + // look up function + dictionary::const_iterator entry = map_invokers.find( func_name ); + if (entry == map_invokers.end()) + throw std::runtime_error("unknown function: " + func_name); + + // call the invoker which controls argument parsing + entry->second(parser); + } + } + +} + diff --git a/example/interpreter_example.cpp b/example/interpreter_example.cpp new file mode 100644 index 0000000..9e6118b --- /dev/null +++ b/example/interpreter_example.cpp @@ -0,0 +1,56 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include + +#include "interpreter.hpp" + +void echo(std::string const & s) +{ + std::cout << s << std::endl; +} + +void add(int a, int b) +{ + std::cout << a + b << std::endl; +} + +void repeat(std::string const & s, int n) +{ + while (--n >= 0) std::cout << s; + std::cout << std::endl; +} + +int main() +{ + example::interpreter interpreter; + + interpreter.register_function("echo", & echo); + interpreter.register_function("add", & add); + interpreter.register_function("repeat", & repeat); + + std::string line = "nonempty"; + while (! line.empty()) + { + std::cout << std::endl << "] ", std::getline(std::cin,line); + + try + { + interpreter.parse_input(line); + } + catch (std::runtime_error &error) + { + std::cerr << error.what() << std::endl; + } + } + + return 0; +} + diff --git a/example/macro_type_args.hpp b/example/macro_type_args.hpp new file mode 100644 index 0000000..3500524 --- /dev/null +++ b/example/macro_type_args.hpp @@ -0,0 +1,73 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ +// +// This example implements a utility to accept a type expression, that may +// contain commas to a macro. +// +// +// Detailed description +// ==================== +// +// Accepting a type as macro argument can cause problems if the type expression +// contains commas: +// +// #define MY_MACRO(a_type) +// ... +// MY_MACRO(std::map) // ERROR (wrong number of macro arguments) +// +// This problem can be solved by pasing using a parenthesized type +// +// MY_MACRO((std::map) // OK +// +// but then there is no way to remove the parentheses in the macro argument +// with the preprocessor. +// We can, however, form a pointer to a function with a single argument (the +// parentheses become part of the type) and extract the argument with template +// metaprogramming: +// +// // Inside the macro definition +// +// typename mpl::front< parameter_types >::type +// +// This code snippet does not read too expressive so we use another macro +// to encapsulate the solution: +// +// // Inside the macro definition +// +// BOOST_EXAMPLE_MACRO_TYPE_ARGUMENT(a_type) +// +// As a generalization of this technique we can accept a comma-separated list of +// types. Omitting the mpl::front invocation gives us an MPL-sequence. +// +// +// Limitations +// =========== +// +// - only works for types that are valid function arguments +// +// Acknowledgments +// =============== +// +// Thanks go to Dave Abrahams for letting me know this technique. + +#ifndef BOOST_EXAMPLE_MACRO_TYPE_ARGUMENT_HPP_INCLUDED +#define BOOST_EXAMPLE_MACRO_TYPE_ARGUMENT_HPP_INCLUDED + +#include +#include + +#define BOOST_EXAMPLE_MACRO_TYPE_ARGUMENT(parenthesized_type) \ + boost::mpl::front< \ + BOOST_EXAMPLE_MACRO_TYPE_LIST_ARGUMENT(parenthesized_type) >::type + +#define BOOST_EXAMPLE_MACRO_TYPE_LIST_ARGUMENT(parenthesized_types) \ + ::boost::function_types::parameter_types< void(*) parenthesized_types > + + +#endif + diff --git a/example/macro_type_args_example.cpp b/example/macro_type_args_example.cpp new file mode 100644 index 0000000..9f83883 --- /dev/null +++ b/example/macro_type_args_example.cpp @@ -0,0 +1,71 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ +// See macro_type_arugment.hpp in this directory for details. + +#include +#include +#include + +#include +#include + +#include "macro_type_args.hpp" + + +#define TYPE_NAME(parenthesized_type) \ + typeid(BOOST_EXAMPLE_MACRO_TYPE_ARGUMENT(parenthesized_type)).name() + +namespace example +{ + namespace mpl = boost::mpl; + + template + struct mpl_seq_to_string_impl + { + static std::string get(std::string const & prev) + { + typedef typename mpl::next::type next_pos; + typedef typename mpl::deref::type type; + + return mpl_seq_to_string_impl::get( + prev + (prev.empty()? '\0' : ',') + typeid(type).name() ); + } + }; + template + struct mpl_seq_to_string_impl + { + static std::string get(std::string const & prev) + { + return prev; + } + }; + + template + std::string mpl_seq_to_string() + { + typedef typename mpl::begin::type begin; + typedef typename mpl::end::type end; + + return mpl_seq_to_string_impl::get(""); + } + +} + +#define TYPE_NAMES(parenthesized_types) \ + ::example::mpl_seq_to_string< \ + BOOST_EXAMPLE_MACRO_TYPE_LIST_ARGUMENT(parenthesized_types) >() + +int main() +{ + std::cout << TYPE_NAME((int)) << std::endl; + + std::cout << TYPE_NAMES((int,char)) << std::endl; + std::cout << TYPE_NAMES((int,char,long)) << std::endl; + +} + diff --git a/example/result_of.hpp b/example/result_of.hpp new file mode 100644 index 0000000..1527221 --- /dev/null +++ b/example/result_of.hpp @@ -0,0 +1,86 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ +// +// Reimplementation of the Boost result_of utility (see [Gregor01] and +// [Gregor02]). +// +// +// Detailed description +// ==================== +// +// This example implements the functionality of the Boost result_of utility. +// Because of FunctionTypes we get away without repetitive code and the Boost +// Preprocessor library. +// +// +// Bibliography +// ============ +// +// [Gregor01] Gregor, D. The Boost result_of utility +// http://www.boost.org/libs/utility +// +// [Gregor02] Gregor, D. A uniform method for computing function object return +// types (revision 1) +// http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1454.html + +#include +#include + +#include +#include + +namespace example +{ + namespace ft = boost::function_types; + namespace mpl = boost::mpl; + + template struct result_of; + + namespace detail + { + BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) + + template + struct result_type_member + { + typedef typename F::result_type type; + }; + + template + struct result_member_template + { + typedef typename F::template result::type type; + }; + +#if !BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x564)) + template + struct result_member_template< F, F(void) > + { + typedef void type; + }; +#endif + + template + struct result_of_impl + : mpl::eval_if + < ft::is_callable_builtin + , ft::result_type + , mpl::eval_if + < has_result_type + , result_type_member + , result_member_template + > > + { }; + } + + template + struct result_of + : detail::result_of_impl< typename ft::result_type::type, Desc > + { }; +} + diff --git a/example/result_of_example.cpp b/example/result_of_example.cpp new file mode 100644 index 0000000..a8fe2d2 --- /dev/null +++ b/example/result_of_example.cpp @@ -0,0 +1,59 @@ + +// (C) Copyright Douglas Gregor 2003-2004. +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ +// This file is a modified copy of the original Boost.ResultOf test-suite. +// See result_of.hpp in this directory for details. + + +#include "result_of.hpp" + +#include +#include +#include + +struct int_result_type { typedef int result_type; }; + +struct int_result_of +{ + template struct result { typedef int type; }; +}; + +struct int_result_type_and_float_result_of +{ + typedef int result_type; + template struct result { typedef float type; }; +}; + +struct X {}; + +int main() +{ + using namespace boost; + namespace e = example; + + typedef int (*func_ptr)(float, double); + typedef int (&func_ref)(float, double); + typedef int (X::*mem_func_ptr)(float); + typedef int (X::*mem_func_ptr_c)(float) const; + typedef int (X::*mem_func_ptr_v)(float) volatile; + typedef int (X::*mem_func_ptr_cv)(float) const volatile; + + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, void>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, void>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + return 0; +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..ee4ce6e --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + +

Automatic redirection failed, please go to + doc/html/index.html.

+

Copyright Tobias Schwinger 2005-2007

+

Distributed under the Boost Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt).

+ + + diff --git a/test/Jamfile b/test/Jamfile new file mode 100644 index 0000000..34658ee --- /dev/null +++ b/test/Jamfile @@ -0,0 +1,85 @@ + +# (C) Copyright Tobias Schwinger +# +# Use, modification and distribution are subject to the Boost Software License, +# Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +#------------------------------------------------------------------------------- + +import testing ; + +{ + test-suite function_types : + + # Classification + + [ compile classification/is_function.cpp ] + [ compile classification/is_function_pointer.cpp ] + [ compile classification/is_function_reference.cpp ] + [ compile classification/is_member_function_pointer.cpp ] + [ compile classification/is_member_object_pointer.cpp ] + [ compile classification/is_callable_builtin.cpp ] + [ compile classification/is_nonmember_callable_builtin.cpp ] + [ compile classification/is_member_pointer.cpp ] + + [ compile classification/is_cv_mem_func_ptr.cpp ] + [ compile classification/is_variadic.cpp ] + [ compile classification/is_cv_pointer.cpp ] + # [ compile classification/is_cv_function.cpp ] + + # Decomposition + + [ compile decomposition/components.cpp ] + [ compile decomposition/result_type.cpp ] + [ compile decomposition/function_arity.cpp ] + [ compile decomposition/parameter_types.cpp ] + + [ compile decomposition/components_seq.cpp ] + [ compile decomposition/class_type_transform.cpp ] + + [ compile-fail decomposition/result_type_fail.cpp ] + [ compile-fail decomposition/parameter_types_fail.cpp ] + [ compile-fail decomposition/function_arity_fail.cpp ] + + # Synthesis + + [ compile synthesis/function_type.cpp ] + [ compile synthesis/function_pointer.cpp ] + [ compile synthesis/function_reference.cpp ] + [ compile synthesis/member_function_pointer.cpp ] + [ compile synthesis/member_object_pointer.cpp ] + + [ compile synthesis/transformation.cpp ] + [ compile synthesis/mem_func_ptr_cv1.cpp ] + [ compile synthesis/mem_func_ptr_cv2.cpp ] + [ compile synthesis/mem_func_ptr_cv_ptr_to_this.cpp ] + [ compile synthesis/variadic_function_synthesis.cpp ] + # [ compile synthesis/cv_function_synthesis.cpp ] + + # Reconfiguration + + [ compile reconfiguration/preprocessing_mode.cpp ] + [ compile reconfiguration/partial_arity_preprocessing.cpp ] + [ compile reconfiguration/cc_preprocessing.cpp ] + + # Custom calling conventions + + [ compile custom_ccs/nonmember_ccs.cpp ] + [ compile custom_ccs/nonmember_ccs_exact.cpp ] + [ compile custom_ccs/member_ccs.cpp ] + [ compile custom_ccs/member_ccs_exact.cpp ] + + # Code from the examples + + [ compile ../example/interpreter_example.cpp ] + [ compile ../example/result_of_example.cpp ] + [ compile ../example/interface_example.cpp ] + [ compile ../example/fast_mem_fn_example.cpp + # needed for Boost.PP file iteration with some compilers + : ../example + ] + [ compile ../example/macro_type_args_example.cpp ] + ; +} + + diff --git a/test/classification/is_callable_builtin.cpp b/test/classification/is_callable_builtin.cpp new file mode 100644 index 0000000..d65f6f3 --- /dev/null +++ b/test/classification/is_callable_builtin.cpp @@ -0,0 +1,86 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +typedef void func(); +typedef void (*func_ptr)(); +typedef void (&func_ref)(); +class C; +typedef void (C::*mem_func_ptr)(); +typedef void (C::*c_mem_func_ptr)() const; +typedef void (C::*v_mem_func_ptr)() volatile; +typedef void (C::*cv_mem_func_ptr)() const volatile; + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< func > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< func_ref > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< c_mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< v_mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< cv_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< mem_func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< C > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< int > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< int* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< int** > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< int& > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< int[] > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< int[1] > +)); + diff --git a/test/classification/is_cv_function.cpp b/test/classification/is_cv_function.cpp new file mode 100644 index 0000000..176300c --- /dev/null +++ b/test/classification/is_cv_function.cpp @@ -0,0 +1,142 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +template +void test_non_cv(T C::*) +{ + BOOST_MPL_ASSERT(( + ft::is_function + )); + + BOOST_MPL_ASSERT(( + ft::is_function + )); + + BOOST_MPL_ASSERT(( + ft::is_function > + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function > + )); +} + +template +void test_c_non_v(T C::*) +{ + BOOST_MPL_ASSERT(( + ft::is_function + )); + + BOOST_MPL_ASSERT(( + ft::is_function + )); + + BOOST_MPL_ASSERT(( + ft::is_function > + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function > + )); +} + +template +void test_v_non_c(T C::*) +{ + BOOST_MPL_ASSERT(( + ft::is_function + )); + + BOOST_MPL_ASSERT(( + ft::is_function + )); + + BOOST_MPL_ASSERT(( + ft::is_function > + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function > + )); +} + +template +void test_cv(T C::*) +{ + BOOST_MPL_ASSERT(( + ft::is_function + )); + + BOOST_MPL_ASSERT(( + ft::is_function + )); + + BOOST_MPL_ASSERT(( + ft::is_function > + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function + )); + + BOOST_MPL_ASSERT_NOT(( + ft::is_function > + )); +} + + +struct C +{ + void non_cv(int) { } + void c_non_v(int) const { } + void v_non_c(int) volatile { } + void cv(int) const volatile { } +}; + +void instanitate() +{ + test_non_cv(& C::non_cv); + test_c_non_v(& C::c_non_v); + test_v_non_c(& C::v_non_c); + test_cv(& C::cv); +} + diff --git a/test/classification/is_cv_mem_func_ptr.cpp b/test/classification/is_cv_mem_func_ptr.cpp new file mode 100644 index 0000000..0b75c43 --- /dev/null +++ b/test/classification/is_cv_mem_func_ptr.cpp @@ -0,0 +1,150 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +class C; +typedef void (C::*mem_func_ptr)(); +typedef void (C::*c_mem_func_ptr)() const; +typedef void (C::*v_mem_func_ptr)() volatile; +typedef void (C::*cv_mem_func_ptr)() const volatile; + + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< mem_func_ptr, ft::non_const > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< mem_func_ptr, ft::non_volatile > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< mem_func_ptr, + ft::tag > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< mem_func_ptr, ft::const_qualified > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< mem_func_ptr, ft::volatile_qualified > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< mem_func_ptr, + ft::tag > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< mem_func_ptr, + ft::tag > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< mem_func_ptr, + ft::tag > +)); + +// + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< c_mem_func_ptr, ft::const_qualified > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< c_mem_func_ptr, ft::non_volatile > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< c_mem_func_ptr, ft::non_const > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< c_mem_func_ptr, ft::volatile_qualified > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< c_mem_func_ptr, + ft::tag > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< c_mem_func_ptr, + ft::tag > +)); + +// + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< v_mem_func_ptr, ft::volatile_qualified > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< v_mem_func_ptr, ft::non_const > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< v_mem_func_ptr, ft::non_volatile > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< v_mem_func_ptr, ft::const_qualified > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< v_mem_func_ptr, + ft::tag > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< v_mem_func_ptr, + ft::tag > +)); + +// + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< cv_mem_func_ptr, ft::const_qualified > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< cv_mem_func_ptr, ft::volatile_qualified > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< cv_mem_func_ptr, ft::non_const > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< cv_mem_func_ptr, ft::non_volatile > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< cv_mem_func_ptr, + ft::tag > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< cv_mem_func_ptr, + ft::tag > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< cv_mem_func_ptr, + ft::tag > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< cv_mem_func_ptr, + ft::tag > +)); + diff --git a/test/classification/is_cv_pointer.cpp b/test/classification/is_cv_pointer.cpp new file mode 100644 index 0000000..383052e --- /dev/null +++ b/test/classification/is_cv_pointer.cpp @@ -0,0 +1,50 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include + +namespace ft = boost::function_types; + +typedef void(* const func_c_ptr)(); +typedef void(* volatile func_v_ptr)(); +typedef void(* const volatile func_cv_ptr)(); +class C; +typedef void(C::* const mem_func_c_ptr)(); +typedef void(C::* volatile mem_func_v_ptr)(); +typedef void(C::* const volatile mem_func_cv_ptr)(); + +// note: the pointer has cv-qualifiers, not the function - non_cv tag must match + +BOOST_MPL_ASSERT(( + ft::is_function_pointer< func_c_ptr, ft::non_cv > +)); + +BOOST_MPL_ASSERT(( + ft::is_function_pointer< func_v_ptr, ft::non_cv > +)); + +BOOST_MPL_ASSERT(( + ft::is_function_pointer< func_cv_ptr, ft::non_cv > +)); + + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< mem_func_c_ptr, ft::non_cv > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< mem_func_v_ptr, ft::non_cv > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< mem_func_cv_ptr, ft::non_cv > +)); + + diff --git a/test/classification/is_function.cpp b/test/classification/is_function.cpp new file mode 100644 index 0000000..9c6a357 --- /dev/null +++ b/test/classification/is_function.cpp @@ -0,0 +1,87 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +typedef void func(); +typedef void (*func_ptr)(); +typedef void (&func_ref)(); +class C; +typedef void (C::*mem_func_ptr)(); +typedef void (C::*c_mem_func_ptr)() const; +typedef void (C::*v_mem_func_ptr)() volatile; +typedef void (C::*cv_mem_func_ptr)() const volatile; + + +BOOST_MPL_ASSERT(( + ft::is_function< func > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< func_ref > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< c_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< v_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< cv_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< mem_func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< C > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< int > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< int* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< int** > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< int& > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< int[] > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function< int[1] > +)); + diff --git a/test/classification/is_function_pointer.cpp b/test/classification/is_function_pointer.cpp new file mode 100644 index 0000000..54ef29f --- /dev/null +++ b/test/classification/is_function_pointer.cpp @@ -0,0 +1,87 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +typedef void func(); +typedef void (*func_ptr)(); +typedef void (&func_ref)(); +class C; +typedef void (C::*mem_func_ptr)(); +typedef void (C::*c_mem_func_ptr)() const; +typedef void (C::*v_mem_func_ptr)() volatile; +typedef void (C::*cv_mem_func_ptr)() const volatile; + + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< func > +)); + +BOOST_MPL_ASSERT(( + ft::is_function_pointer< func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< func_ref > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< c_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< v_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< cv_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< mem_func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< C > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< int > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< int* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< int** > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< int& > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< int[] > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_pointer< int[1] > +)); + diff --git a/test/classification/is_function_reference.cpp b/test/classification/is_function_reference.cpp new file mode 100644 index 0000000..2f8f006 --- /dev/null +++ b/test/classification/is_function_reference.cpp @@ -0,0 +1,88 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +typedef void func(); +typedef void (*func_ptr)(); +typedef void (&func_ref)(); +class C; +typedef void (C::*mem_func_ptr)(); +typedef void (C::*c_mem_func_ptr)() const; +typedef void (C::*v_mem_func_ptr)() volatile; +typedef void (C::*cv_mem_func_ptr)() const volatile; + + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< func > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_function_reference< func_ref > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< c_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< v_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< cv_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< mem_func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< C > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< int > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< int* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< int** > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< int& > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< int[] > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_function_reference< int[1] > +)); + + diff --git a/test/classification/is_member_function_pointer.cpp b/test/classification/is_member_function_pointer.cpp new file mode 100644 index 0000000..0548c37 --- /dev/null +++ b/test/classification/is_member_function_pointer.cpp @@ -0,0 +1,96 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +typedef void func(); +typedef void (*func_ptr)(); +typedef void (&func_ref)(); +class C; +typedef void (C::*mem_func_ptr)(); +typedef void (C::*c_mem_func_ptr)() const; +typedef void (C::*v_mem_func_ptr)() volatile; +typedef void (C::*cv_mem_func_ptr)() const volatile; +typedef int C::*mem_ptr; + + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< func > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< func_ref > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< c_mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< v_mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_function_pointer< cv_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< mem_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< mem_func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< mem_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< C > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< int > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< int* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< int** > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< int& > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< int[] > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_function_pointer< int[1] > +)); + diff --git a/test/classification/is_member_object_pointer.cpp b/test/classification/is_member_object_pointer.cpp new file mode 100644 index 0000000..8408327 --- /dev/null +++ b/test/classification/is_member_object_pointer.cpp @@ -0,0 +1,95 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +typedef void func(); +typedef void (*func_ptr)(); +typedef void (&func_ref)(); +class C; +typedef void (C::*mem_func_ptr)(); +typedef void (C::*c_mem_func_ptr)() const; +typedef void (C::*v_mem_func_ptr)() volatile; +typedef void (C::*cv_mem_func_ptr)() const volatile; +typedef int C::*mem_ptr; + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< func > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< func_ref > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< c_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< v_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< cv_mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_object_pointer< mem_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< mem_func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< mem_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< C > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< int > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< int* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< int** > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< int& > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< int[] > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_object_pointer< int[1] > +)); + diff --git a/test/classification/is_member_pointer.cpp b/test/classification/is_member_pointer.cpp new file mode 100644 index 0000000..1139027 --- /dev/null +++ b/test/classification/is_member_pointer.cpp @@ -0,0 +1,88 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +typedef void func(); +typedef void (*func_ptr)(); +typedef void (&func_ref)(); +class C; +typedef void (C::*mem_func_ptr)(); +typedef void (C::*c_mem_func_ptr)() const; +typedef void (C::*v_mem_func_ptr)() volatile; +typedef void (C::*cv_mem_func_ptr)() const volatile; +typedef int C::*mem_ptr; + + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< func > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< func_ref > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_pointer< mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_pointer< c_mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_pointer< v_mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_pointer< cv_mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_member_pointer< mem_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< mem_func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< mem_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< C > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< int > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< int* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< int** > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_member_pointer< int& > +)); + diff --git a/test/classification/is_nonmember_callable_builtin.cpp b/test/classification/is_nonmember_callable_builtin.cpp new file mode 100644 index 0000000..902d6ee --- /dev/null +++ b/test/classification/is_nonmember_callable_builtin.cpp @@ -0,0 +1,87 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +typedef void func(); +typedef void (*func_ptr)(); +typedef void (&func_ref)(); +class C; +typedef void (C::*mem_func_ptr)(); +typedef void (C::*c_mem_func_ptr)() const; +typedef void (C::*v_mem_func_ptr)() volatile; +typedef void (C::*cv_mem_func_ptr)() const volatile; + + +BOOST_MPL_ASSERT(( + ft::is_nonmember_callable_builtin< func > +)); + +BOOST_MPL_ASSERT(( + ft::is_nonmember_callable_builtin< func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_nonmember_callable_builtin< func_ref > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< c_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< v_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< cv_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< mem_func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< C > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< int > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< int* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< int** > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< int& > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< int[] > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_nonmember_callable_builtin< int[1] > +)); + diff --git a/test/classification/is_variadic.cpp b/test/classification/is_variadic.cpp new file mode 100644 index 0000000..964ea8c --- /dev/null +++ b/test/classification/is_variadic.cpp @@ -0,0 +1,143 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +namespace ft = boost::function_types; + +typedef void func(...); +typedef void nv_func(); +typedef void (*func_ptr)(...); +typedef void (*nv_func_ptr)(); +typedef void (&func_ref)(...); +typedef void (&nv_func_ref)(); +class C; +typedef void (C::*mem_func_ptr)(...); +typedef void (C::*nv_mem_func_ptr)(); +typedef void (C::*c_mem_func_ptr)(...) const; +typedef void (C::*v_mem_func_ptr)(...) volatile; +typedef void (C::*cv_mem_func_ptr)(...) const volatile; +typedef int C::* mem_ptr; + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< func > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< func, ft::variadic > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< func, ft::non_variadic > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< nv_func > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< nv_func, ft::variadic > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< nv_func, ft::non_variadic > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< func_ptr, ft::variadic> +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< func_ptr, ft::non_variadic > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< nv_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< nv_func_ptr, ft::variadic> +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< nv_func_ptr, ft::non_variadic > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< func_ref > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< mem_func_ptr, ft::variadic > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< mem_func_ptr, ft::non_variadic > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< nv_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< nv_mem_func_ptr, ft::variadic > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< nv_mem_func_ptr, ft::non_variadic > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< c_mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< v_mem_func_ptr > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< cv_mem_func_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< mem_func_ptr* > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< C, ft::variadic > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< C, ft::non_variadic > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< mem_ptr > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< mem_ptr, ft::variadic > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< mem_ptr, ft::non_variadic > +)); + diff --git a/test/custom_ccs/member_ccs.cpp b/test/custom_ccs/member_ccs.cpp new file mode 100644 index 0000000..727b38b --- /dev/null +++ b/test/custom_ccs/member_ccs.cpp @@ -0,0 +1,50 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS + +#include +#include +#include +#include + +#ifndef BOOST_FT_CC_STDCALL +# error "test not supported with this compiler" +#endif + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; + +typedef ft::stdcall_cc cc; + +class C; + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< + ft::member_function_pointer, cc>::type + > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< + ft::member_function_pointer, cc>::type + > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< + ft::member_function_pointer, cc>::type + > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< + ft::member_function_pointer, cc>::type + > +)); + diff --git a/test/custom_ccs/member_ccs_exact.cpp b/test/custom_ccs/member_ccs_exact.cpp new file mode 100644 index 0000000..2decf14 --- /dev/null +++ b/test/custom_ccs/member_ccs_exact.cpp @@ -0,0 +1,71 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS + +#include +#include +#include +#include + +#ifndef BOOST_FT_CC_STDCALL +# error "test not supported with this compiler" +#endif + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; + +typedef ft::stdcall_cc cc; +typedef ft::default_cc dc; + +class C; + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< ft::member_function_pointer, cc>::type, cc > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< ft::member_function_pointer, cc>::type, cc > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< ft::member_function_pointer, cc>::type, cc > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< ft::member_function_pointer, cc>::type, cc > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< ft::member_function_pointer >::type, dc > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< ft::member_function_pointer, cc>::type, dc > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< ft::member_function_pointer, cc>::type, dc > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< ft::member_function_pointer, cc>::type, dc > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< ft::member_function_pointer, cc>::type, dc > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< ft::member_function_pointer >::type, cc > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< ft::member_function_pointer, cc>::type, dc > +)); + diff --git a/test/custom_ccs/nonmember_ccs.cpp b/test/custom_ccs/nonmember_ccs.cpp new file mode 100644 index 0000000..98bf3d5 --- /dev/null +++ b/test/custom_ccs/nonmember_ccs.cpp @@ -0,0 +1,45 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS + +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_FT_CC_STDCALL +# error "test not supported with this compiler" +#endif + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; + +typedef ft::stdcall_cc cc; + + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< + ft::function_type, cc>::type + > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< + ft::function_pointer, cc>::type + > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< + ft::function_reference, cc>::type + > +)); + diff --git a/test/custom_ccs/nonmember_ccs_exact.cpp b/test/custom_ccs/nonmember_ccs_exact.cpp new file mode 100644 index 0000000..31f73c0 --- /dev/null +++ b/test/custom_ccs/nonmember_ccs_exact.cpp @@ -0,0 +1,62 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS + +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_FT_CC_STDCALL +# error "test not supported with this compiler" +#endif + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; + +typedef ft::stdcall_cc cc; +typedef ft::default_cc dc; + + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< ft::function_type,cc>::type, cc > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< ft::function_pointer,cc>::type, cc > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< ft::function_reference,cc>::type, cc > +)); + +BOOST_MPL_ASSERT(( + ft::is_callable_builtin< ft::function_pointer >::type, dc > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< ft::function_type, cc>::type, dc > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< ft::function_pointer,cc>::type, dc > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< ft::function_reference,cc>::type, dc > +)); + +BOOST_MPL_ASSERT_NOT(( + ft::is_callable_builtin< ft::function_pointer >::type, cc > +)); + + + diff --git a/test/decomposition/class_type_transform.cpp b/test/decomposition/class_type_transform.cpp new file mode 100644 index 0000000..f007a40 --- /dev/null +++ b/test/decomposition/class_type_transform.cpp @@ -0,0 +1,62 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +#include +#include +#include +#include + +#include +#include + +using namespace boost; +namespace ft = function_types; +using boost::mpl::placeholders::_; + +class C; +typedef C (C::*mem_func_ptr)(); +class X; + +BOOST_MPL_ASSERT(( + is_same< mpl::at_c< + ft::components > + ,1 >::type, C* > +)); +BOOST_MPL_ASSERT(( + is_same< mpl::at_c< + ft::components > > + ,1 >::type, C** > +)); +BOOST_MPL_ASSERT(( + is_same< mpl::at_c< + ft::components > + ,1 >::type, X > +)); + +BOOST_MPL_ASSERT(( + is_same< mpl::at_c< + ft::parameter_types > + ,0 >::type, C* > +)); +BOOST_MPL_ASSERT(( + is_same< mpl::at_c< + ft::parameter_types > > + ,0 >::type, C** > +)); +BOOST_MPL_ASSERT(( + is_same< mpl::at_c< + ft::parameter_types > + ,0 >::type, X > +)); + + + + diff --git a/test/decomposition/components.cpp b/test/decomposition/components.cpp new file mode 100644 index 0000000..60cebde --- /dev/null +++ b/test/decomposition/components.cpp @@ -0,0 +1,59 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include + +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; + +class C; +typedef C func(); +typedef C (*func_ptr)(int); +typedef C (&func_ref)(int,int); +typedef C (C::*mem_func_ptr)(); +typedef C (C::*c_mem_func_ptr)(int) const; +typedef C (C::*v_mem_func_ptr)(int,int) volatile; +typedef C (C::*cv_mem_func_ptr)(int,int,int) const volatile; +typedef int C::* mem_ptr; + +BOOST_MPL_ASSERT(( + mpl::equal< ft::components::types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::components::types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::components::types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::components::types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::components::types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::components::types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::components::types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::components::types, mpl::vector > +)); + diff --git a/test/decomposition/components_seq.cpp b/test/decomposition/components_seq.cpp new file mode 100644 index 0000000..ad5f590 --- /dev/null +++ b/test/decomposition/components_seq.cpp @@ -0,0 +1,75 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; +using boost::is_same; + +class C; +typedef C (C::* mem_func_ptr)(int); +typedef ft::components c; + + +// front +BOOST_MPL_ASSERT(( is_same< ::boost::mpl::front::type, C > )); + +// back +BOOST_MPL_ASSERT(( is_same< ::boost::mpl::back::type, int > )); + +// at +BOOST_MPL_ASSERT(( is_same< ::boost::mpl::at_c::type, C > )); +BOOST_MPL_ASSERT(( is_same< ::boost::mpl::at_c::type, C & > )); +BOOST_MPL_ASSERT(( is_same< ::boost::mpl::at_c::type, int > )); + +// begin/end +BOOST_MPL_ASSERT(( mpl::equal< c, mpl::vector > )); + + +// clear +BOOST_MPL_ASSERT(( mpl::equal< mpl::clear, mpl::vector<> > )); + +// push_front +BOOST_MPL_ASSERT(( mpl::equal< mpl::push_front::type, mpl::vector > )); + +// pop_front +BOOST_MPL_ASSERT(( mpl::equal< mpl::pop_front::type, mpl::vector > )); + +// push_back +BOOST_MPL_ASSERT(( mpl::equal< mpl::push_back::type, mpl::vector > )); + +// pop_back +BOOST_MPL_ASSERT(( mpl::equal< mpl::pop_back::type, mpl::vector > )); + + +// size +BOOST_MPL_ASSERT_RELATION( ::boost::mpl::size::value, ==, 3 ); + +// empty +BOOST_MPL_ASSERT_NOT(( mpl::empty )); +BOOST_MPL_ASSERT(( mpl::empty< mpl::clear > )); + diff --git a/test/decomposition/function_arity.cpp b/test/decomposition/function_arity.cpp new file mode 100644 index 0000000..219c2c6 --- /dev/null +++ b/test/decomposition/function_arity.cpp @@ -0,0 +1,31 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include + +#include + +class C; +typedef C func(); +typedef C (*func_ptr)(int); +typedef C (&func_ref)(int,int); +typedef C (C::*mem_func_ptr)(); +typedef C (C::*c_mem_func_ptr)(int) const; +typedef C (C::*v_mem_func_ptr)(int,int) volatile; +typedef C (C::*cv_mem_func_ptr)(int,int,int) const volatile; +typedef int C::* mem_ptr; + +BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 0 ); +BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 1 ); +BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 2 ); +BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 1 ); +BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 2 ); +BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 3 ); +BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 4 ); +BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity::value, ==, 1 ); + diff --git a/test/decomposition/function_arity_fail.cpp b/test/decomposition/function_arity_fail.cpp new file mode 100644 index 0000000..39a7c74 --- /dev/null +++ b/test/decomposition/function_arity_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include + + +namespace ft = boost::function_types; + +class C; + +typedef ft::function_arity::type error_1; +typedef ft::function_arity::type error_2; +typedef ft::function_arity::type error_3; + diff --git a/test/decomposition/parameter_types.cpp b/test/decomposition/parameter_types.cpp new file mode 100644 index 0000000..5feb1a8 --- /dev/null +++ b/test/decomposition/parameter_types.cpp @@ -0,0 +1,59 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include + +#include + + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; + +class C; +typedef C func(C); +typedef C (*func_ptr)(C,int); +typedef C (&func_ref)(); +typedef C (C::*mem_func_ptr)(C,int); +typedef C (C::*c_mem_func_ptr)(C,C) const; +typedef C (C::*v_mem_func_ptr)(C) volatile; +typedef C (C::*cv_mem_func_ptr)() const volatile; +typedef C C::*mem_ptr; + +BOOST_MPL_ASSERT(( + mpl::equal< ft::parameter_types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::parameter_types::type, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::parameter_types, mpl::vector<> > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::parameter_types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::parameter_types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::parameter_types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::parameter_types, mpl::vector > +)); + +BOOST_MPL_ASSERT(( + mpl::equal< ft::parameter_types, mpl::vector > +)); diff --git a/test/decomposition/parameter_types_fail.cpp b/test/decomposition/parameter_types_fail.cpp new file mode 100644 index 0000000..d23e891 --- /dev/null +++ b/test/decomposition/parameter_types_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include + + +namespace ft = boost::function_types; + +class C; + +typedef ft::parameter_types::type error_1; +typedef ft::parameter_types::type error_2; +typedef ft::parameter_types::type error_3; + diff --git a/test/decomposition/result_type.cpp b/test/decomposition/result_type.cpp new file mode 100644 index 0000000..8f1157d --- /dev/null +++ b/test/decomposition/result_type.cpp @@ -0,0 +1,63 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +#include + + +namespace ft = boost::function_types; + +class C; +typedef C func(); +typedef C (*func_ptr)(); +typedef C (&func_ref)(); +typedef C (C::*mem_func_ptr)(); +typedef C (C::*c_mem_func_ptr)() const; +typedef C (C::*v_mem_func_ptr)() volatile; +typedef C (C::*cv_mem_func_ptr)() const volatile; +typedef int C::* mem_ptr; +typedef int const C::* c_mem_ptr; + +BOOST_MPL_ASSERT(( + boost::is_same::type,C> +)); + +BOOST_MPL_ASSERT(( + boost::is_same::type,C> +)); + +BOOST_MPL_ASSERT(( + boost::is_same::type,C> +)); + +BOOST_MPL_ASSERT(( + boost::is_same::type,C> +)); + +BOOST_MPL_ASSERT(( + boost::is_same::type,C> +)); + +BOOST_MPL_ASSERT(( + boost::is_same::type,C> +)); + +BOOST_MPL_ASSERT(( + boost::is_same::type,C> +)); + +BOOST_MPL_ASSERT(( + boost::is_same::type,int&> +)); + +BOOST_MPL_ASSERT(( + boost::is_same::type,int const&> +)); + diff --git a/test/decomposition/result_type_fail.cpp b/test/decomposition/result_type_fail.cpp new file mode 100644 index 0000000..c701e57 --- /dev/null +++ b/test/decomposition/result_type_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include + + +namespace ft = boost::function_types; + +class C; + +typedef ft::result_type::type error_1; +typedef ft::result_type::type error_2; +typedef ft::result_type::type error_3; + diff --git a/test/reconfiguration/cc_preprocessing.cpp b/test/reconfiguration/cc_preprocessing.cpp new file mode 100644 index 0000000..889645d --- /dev/null +++ b/test/reconfiguration/cc_preprocessing.cpp @@ -0,0 +1,11 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#define BOOST_FT_CC_PREPROCESSING 1 +#include "simple_test.hpp" + diff --git a/test/reconfiguration/partial_arity_preprocessing.cpp b/test/reconfiguration/partial_arity_preprocessing.cpp new file mode 100644 index 0000000..bd58cf9 --- /dev/null +++ b/test/reconfiguration/partial_arity_preprocessing.cpp @@ -0,0 +1,11 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#define BOOST_FT_MAX_ARITY 19 +#include "simple_test.hpp" + diff --git a/test/reconfiguration/preprocessing_mode.cpp b/test/reconfiguration/preprocessing_mode.cpp new file mode 100644 index 0000000..d6601c4 --- /dev/null +++ b/test/reconfiguration/preprocessing_mode.cpp @@ -0,0 +1,11 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#define BOOST_FT_PREPROCESSING_MODE 1 +#include "simple_test.hpp" + diff --git a/test/reconfiguration/simple_test.hpp b/test/reconfiguration/simple_test.hpp new file mode 100644 index 0000000..5b62a0b --- /dev/null +++ b/test/reconfiguration/simple_test.hpp @@ -0,0 +1,51 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include +#include + +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; + +class C; +typedef void func(C &); +typedef int (C::* mem_func_ptr)(int); + +typedef ft::components func_components; +typedef ft::components mfp_components; + +BOOST_MPL_ASSERT(( + mpl::equal< func_components::types, mpl::vector > +)); +BOOST_MPL_ASSERT_RELATION( + ::func_components::function_arity::value, ==, 1 +); + +BOOST_MPL_ASSERT(( + boost::is_same< ft::function_type< mpl::vector >::type, func > +)); + + +BOOST_MPL_ASSERT(( + mpl::equal< mfp_components::types, mpl::vector > +)); +BOOST_MPL_ASSERT_RELATION( + ::mfp_components::function_arity::value, ==, 2 +); + +BOOST_MPL_ASSERT(( + boost::is_same< ft::member_function_pointer< mpl::vector >::type, mem_func_ptr > +)); + + diff --git a/test/synthesis/cv_function_synthesis.cpp b/test/synthesis/cv_function_synthesis.cpp new file mode 100644 index 0000000..b80e854 --- /dev/null +++ b/test/synthesis/cv_function_synthesis.cpp @@ -0,0 +1,249 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; + +template +void test_non_cv(T C::*) +{ + BOOST_MPL_ASSERT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT(( boost::is_same< + ft::function_type< mpl::vector, ft::non_const >::type + , T + >)); + + BOOST_MPL_ASSERT(( boost::is_same< + ft::function_type< mpl::vector, ft::non_volatile >::type + , T + >)); + + BOOST_MPL_ASSERT(( boost::is_same< + ft::function_type< mpl::vector >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, ft::const_qualified >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( + boost::is_same< + ft::function_type< mpl::vector, ft::volatile_qualified >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); +} + +template +void test_c_non_v(T C::*) +{ + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, ft::non_const >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, ft::non_volatile >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector >::type + , T + >)); + + BOOST_MPL_ASSERT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT(( boost::is_same< + ft::function_type< mpl::vector, ft::const_qualified >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( + boost::is_same< + ft::function_type< mpl::vector, ft::volatile_qualified >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); +} + +template +void test_v_non_c(T C::*) +{ + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, ft::non_const >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, ft::non_volatile >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, ft::const_qualified >::type + , T + >)); + + BOOST_MPL_ASSERT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT(( + boost::is_same< + ft::function_type< mpl::vector, ft::volatile_qualified >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); +} + +template +void test_cv(T C::*) +{ + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, ft::non_const >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, ft::non_volatile >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, ft::const_qualified >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); + + BOOST_MPL_ASSERT_NOT(( + boost::is_same< + ft::function_type< mpl::vector, ft::volatile_qualified >::type + , T + >)); + + BOOST_MPL_ASSERT(( boost::is_same< + ft::function_type< mpl::vector, + ft::tag >::type + , T + >)); +} + + +struct C +{ + void non_cv(int) { } + void c_non_v(int) const { } + void v_non_c(int) volatile { } + void cv(int) const volatile { } +}; + +void instanitate() +{ + test_non_cv(& C::non_cv); + test_c_non_v(& C::c_non_v); + test_v_non_c(& C::v_non_c); + test_cv(& C::cv); +} + diff --git a/test/synthesis/function_pointer.cpp b/test/synthesis/function_pointer.cpp new file mode 100644 index 0000000..1150934 --- /dev/null +++ b/test/synthesis/function_pointer.cpp @@ -0,0 +1,24 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; + +using boost::is_same; + +typedef int (* expected)(int,int); + +BOOST_MPL_ASSERT(( + is_same< ft::function_pointer< mpl::vector >::type, expected > +)); + diff --git a/test/synthesis/function_reference.cpp b/test/synthesis/function_reference.cpp new file mode 100644 index 0000000..92fa714 --- /dev/null +++ b/test/synthesis/function_reference.cpp @@ -0,0 +1,24 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; + +using boost::is_same; + +typedef int (& expected)(int); + +BOOST_MPL_ASSERT(( + is_same< ft::function_reference< mpl::vector >::type, expected > +)); + diff --git a/test/synthesis/function_type.cpp b/test/synthesis/function_type.cpp new file mode 100644 index 0000000..bb08ce7 --- /dev/null +++ b/test/synthesis/function_type.cpp @@ -0,0 +1,23 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; +using boost::is_same; + +typedef int expected(int,int); + +BOOST_MPL_ASSERT(( + is_same< ft::function_type< mpl::vector >::type, expected > +)); + diff --git a/test/synthesis/mem_func_ptr_cv1.cpp b/test/synthesis/mem_func_ptr_cv1.cpp new file mode 100644 index 0000000..b1f70be --- /dev/null +++ b/test/synthesis/mem_func_ptr_cv1.cpp @@ -0,0 +1,94 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; +using boost::is_same; + +class C; + +typedef int (C::* expected1)(int); +typedef int (C::* expected2)(int) const; +typedef int (C::* expected3)(int) volatile; +typedef int (C::* expected4)(int) const volatile; + +// implicitly specified cv qualification + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector >::type + , expected1 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector >::type + , expected2 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< + mpl::vector >::type + , expected3 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< + mpl::vector >::type + , expected4 > +)); + +// implicit & explicit/overrides + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< + mpl::vector + , ft::tag >::type + , expected1 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected2 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected3 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected4 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected4 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector + , ft::const_qualified >::type + , expected4 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector + , ft::volatile_qualified >::type + , expected4 > +)); + + diff --git a/test/synthesis/mem_func_ptr_cv2.cpp b/test/synthesis/mem_func_ptr_cv2.cpp new file mode 100644 index 0000000..007efa0 --- /dev/null +++ b/test/synthesis/mem_func_ptr_cv2.cpp @@ -0,0 +1,94 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; +using boost::is_same; + +class C; + +typedef int (C::* expected1)(int); +typedef int (C::* expected2)(int) const; +typedef int (C::* expected3)(int) volatile; +typedef int (C::* expected4)(int) const volatile; + +// implicitly specified cv qualification + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector >::type + , expected1 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector >::type + , expected2 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< + mpl::vector >::type + , expected3 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< + mpl::vector >::type + , expected4 > +)); + +// implicit & explicit/overrides + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< + mpl::vector + , ft::tag >::type + , expected1 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected2 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected3 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected4 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected4 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector + , ft::const_qualified >::type + , expected4 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector + , ft::volatile_qualified >::type + , expected4 > +)); + + diff --git a/test/synthesis/mem_func_ptr_cv_ptr_to_this.cpp b/test/synthesis/mem_func_ptr_cv_ptr_to_this.cpp new file mode 100644 index 0000000..1b6d906 --- /dev/null +++ b/test/synthesis/mem_func_ptr_cv_ptr_to_this.cpp @@ -0,0 +1,37 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; +using boost::is_same; + +class C; +typedef int (C::* expected)(); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector >::type + , expected > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector >::type + , expected > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector >::type + , expected > +)); + + + diff --git a/test/synthesis/member_function_pointer.cpp b/test/synthesis/member_function_pointer.cpp new file mode 100644 index 0000000..6234c47 --- /dev/null +++ b/test/synthesis/member_function_pointer.cpp @@ -0,0 +1,66 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; +using boost::is_same; + +class C; + +typedef int (C::* expected1)(int); +typedef int (C::* expected2)(int) const; +typedef int (C::* expected3)(int) volatile; +typedef int (C::* expected4)(int) const volatile; + + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector >::type + , expected1 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected1 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector + , ft::const_qualified >::type + , expected2 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected2 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector + , ft::volatile_qualified >::type + , expected3 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected3 > +)); + +BOOST_MPL_ASSERT(( + is_same< ft::member_function_pointer< mpl::vector, + ft::tag >::type + , expected4 > +)); + diff --git a/test/synthesis/member_object_pointer.cpp b/test/synthesis/member_object_pointer.cpp new file mode 100644 index 0000000..65af741 --- /dev/null +++ b/test/synthesis/member_object_pointer.cpp @@ -0,0 +1,27 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; +using boost::is_same; + +class C; + +typedef int C::* expected; + + +BOOST_MPL_ASSERT(( + is_same< ft::member_object_pointer< mpl::vector >::type + , expected > +)); + diff --git a/test/synthesis/transformation.cpp b/test/synthesis/transformation.cpp new file mode 100644 index 0000000..3885647 --- /dev/null +++ b/test/synthesis/transformation.cpp @@ -0,0 +1,75 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include + +#include +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; +using boost::is_same; + +class C; + +typedef C func1(C &); +typedef C (*func_ptr1)(C &); +typedef C (&func_ref1)(C &); +typedef C (C::*mem_func_ptr1)(); + +BOOST_MPL_ASSERT(( is_same< func1, ft::function_type::type > )); +BOOST_MPL_ASSERT(( is_same< func1, ft::function_type::type > )); +BOOST_MPL_ASSERT(( is_same< func1, ft::function_type::type > )); +BOOST_MPL_ASSERT(( is_same< func1, ft::function_type::type > )); + +BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer::type > )); + +BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference::type > )); +BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference::type > )); +BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference::type > )); +BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference::type > )); + +BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer::type > )); + + +typedef C func2(C const &); +typedef C (*func_ptr2)(C const &); +typedef C (&func_ref2)(C const &); +typedef C (C::*mem_func_ptr2)() const; + +BOOST_MPL_ASSERT(( is_same< func2, ft::function_type::type > )); +BOOST_MPL_ASSERT(( is_same< func2, ft::function_type::type > )); +BOOST_MPL_ASSERT(( is_same< func2, ft::function_type::type > )); +BOOST_MPL_ASSERT(( is_same< func2, ft::function_type::type > )); + +BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer::type > )); + +BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference::type > )); +BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference::type > )); +BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference::type > )); +BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference::type > )); + +BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer::type > )); +BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer::type > )); + + + diff --git a/test/synthesis/variadic_function_synthesis.cpp b/test/synthesis/variadic_function_synthesis.cpp new file mode 100644 index 0000000..d35b319 --- /dev/null +++ b/test/synthesis/variadic_function_synthesis.cpp @@ -0,0 +1,63 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#include +#include +#include + +#include +#include +#include +#include + +namespace ft = boost::function_types; +namespace mpl = boost::mpl; +using boost::is_same; + +class C; +typedef int expected_v_1(...); +typedef int expected_nv_1(); +typedef int (C::*expected_v_2)(...); +typedef int (C::*expected_nv_2)(); + +BOOST_MPL_ASSERT(( is_same< + ft::function_type, ft::variadic>::type, expected_v_1 +> )); + +BOOST_MPL_ASSERT(( is_same< + ft::function_type, ft::non_variadic>::type, expected_nv_1 +> )); + +BOOST_MPL_ASSERT(( is_same< + ft::function_pointer, ft::variadic>::type, expected_v_1 * +> )); + +BOOST_MPL_ASSERT(( is_same< + ft::function_pointer, ft::non_variadic>::type + , expected_nv_1 * +> )); + +BOOST_MPL_ASSERT(( is_same< + ft::function_reference, ft::variadic>::type, expected_v_1 & +> )); + +BOOST_MPL_ASSERT(( is_same< + ft::function_reference, ft::non_variadic>::type + , expected_nv_1 & +> )); + +BOOST_MPL_ASSERT(( is_same< + ft::member_function_pointer, ft::variadic>::type + , expected_v_2 +> )); + +BOOST_MPL_ASSERT(( is_same< + ft::member_function_pointer, ft::non_variadic>::type + , expected_nv_2 +> )); + From 51aca6c98cfd8f03b1ceb1a34109a2d3af15938f Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 16 Mar 2008 11:38:32 +0000 Subject: [PATCH 03/15] Rebuild a lot of documentation. [SVN r43650] --- .../boost_functiontypes/about_tag_types.html | 23 +++-- .../boost_functiontypes/acknowledgements.html | 21 ++-- .../boost_functiontypes/introduction.html | 36 +++---- doc/html/boost_functiontypes/rationale.html | 91 ++++++++--------- doc/html/boost_functiontypes/reference.html | 24 +++-- .../reference/classification.html | 99 +++++++++---------- .../reference/decomposition.html | 58 +++++------ .../boost_functiontypes/reference/macros.html | 91 ++++++++--------- .../reference/synthesis.html | 66 ++++++------- .../reference/tag_types.html | 98 +++++++++--------- doc/html/boost_functiontypes/use_cases.html | 26 ++--- doc/html/index.html | 16 +-- 12 files changed, 335 insertions(+), 314 deletions(-) diff --git a/doc/html/boost_functiontypes/about_tag_types.html b/doc/html/boost_functiontypes/about_tag_types.html index 217b2ab..2cf1396 100644 --- a/doc/html/boost_functiontypes/about_tag_types.html +++ b/doc/html/boost_functiontypes/about_tag_types.html @@ -1,21 +1,21 @@ - About Tag Types +About Tag Types - + - - + + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -24,7 +24,8 @@

Boost.FunctionTypes uses tag types to encode properties that are not types per se, such as calling convention or whether a function is variadic or cv- @@ -84,7 +85,11 @@ - +
Copyright © 2004 -2007 Tobias Schwinger


diff --git a/doc/html/boost_functiontypes/acknowledgements.html b/doc/html/boost_functiontypes/acknowledgements.html index e8c7c26..7a2e1f3 100644 --- a/doc/html/boost_functiontypes/acknowledgements.html +++ b/doc/html/boost_functiontypes/acknowledgements.html @@ -1,20 +1,20 @@ - Acknowledgements +Acknowledgements - + - + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -23,7 +23,8 @@

Thanks go to the following people for supporting the development of this library in one or the other way: @@ -75,7 +76,11 @@ - +
Copyright © 2004 -2007 Tobias Schwinger


diff --git a/doc/html/boost_functiontypes/introduction.html b/doc/html/boost_functiontypes/introduction.html index 58151d4..306b3c8 100644 --- a/doc/html/boost_functiontypes/introduction.html +++ b/doc/html/boost_functiontypes/introduction.html @@ -1,21 +1,21 @@ - Introduction +Introduction - + - + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -24,7 +24,8 @@

Boost.FunctionTypes provides functionality to classify, decompose and synthesize function, function pointer, function reference and pointer to member types. @@ -56,35 +57,34 @@ constant called value.

-is_function_pointer< bool(*)(int) >::value // == true 
+is_function_pointer< bool(*)(int) >::value // == true 
 
-function_arity< bool(*)(int) >::value // == 1
+function_arity< bool(*)(int) >::value // == 1
 

Templates that encapsulate properties that are single types contain a type member called type.

-function_type< mpl::vector<bool,int> >::type // is bool(int)
+function_type< mpl::vector<bool,int> >::type // is bool(int)
 
-result_type< bool(&)(int) >::type // is bool
+result_type< bool(&)(int) >::type // is bool
 

Templates that encapsulate properties that are type lists model an MPL-compatible type sequence.

-parameter_types< bool(int) > // models an MPL sequence
+parameter_types< bool(int) > // models an MPL sequence
 
- +
Copyright © 2004 -2007 Tobias Schwinger

diff --git a/doc/html/boost_functiontypes/rationale.html b/doc/html/boost_functiontypes/rationale.html index 1b71df4..e2a1952 100644 --- a/doc/html/boost_functiontypes/rationale.html +++ b/doc/html/boost_functiontypes/rationale.html @@ -1,21 +1,21 @@ - Rationale +Rationale - + - - + + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -24,12 +24,13 @@
+

+ + Error handling rationale -

+

The library does not define the required members of class templates in case of an error. This technique causes the compiler to stop displaying diagnostics @@ -40,10 +41,10 @@ The library's components have limited error conditions, so problematic input can be spotted easily.

-

- - Why MPL Sequences? -

+

+ + Why MPL Sequences? +

MPL provides algorithms on Sequences, so transformations (such as turning by-value parameter types into const references for optimized forwarding or computing @@ -53,20 +54,20 @@ other Boost libraries (most importantly Fusion), so another reason is interoperability.

-

- - Pointer +

+ + Pointer to member object types -

+

Despite their syntax, pointer to member object types can be seen as dereferencing functionals.

-

- - The +

+ + The ClassTransform template parameter -

+

This-pointer, this-reference or just the object (or maybe even a smart pointer to the object) plus adjustments of @@ -79,10 +80,10 @@ client to adjust the class type before the sequence is formed and then treat all parameters uniformly.

-

- - Why tag types? -

+

+ + Why tag types? +

Let's consider the alternatives.

@@ -98,12 +99,12 @@ parameters do not work within MPL lambda expressions and can cause problems with older compilers.

-

- - Is +

+ + Is it safe to have the synthesis templates take a callable builtin type or an MPL sequence as the first template argument? -

+

Yes, but it isn't immediately obvious as the set of possible MPL sequences isn't inherently disjoint from the set of callable builtin types. @@ -113,25 +114,23 @@ idea, because builtin types are accessible before the headers that make the type a sequence have been included, which can easily violate the ODR.

-

- - Why +

+ + Why does the hidden this parameter count for the function arity of member functions? -

+

It was found preferable that the following condition holds:

-mpl::size< parameter_types<T> >::value == function_arity<T>::value
+mpl::size< parameter_types<T> >::value == function_arity<T>::value
 
-

- - Why +

+ + Why ignore top-level cv-qualifiers on pointers? -

+

A cv-qualified pointer is still a pointer. It usually doesn't matter and even if it does, it's a job for Boost.TypeTraits. @@ -139,7 +138,11 @@ - +
Copyright © 2004 -2007 Tobias Schwinger


diff --git a/doc/html/boost_functiontypes/reference.html b/doc/html/boost_functiontypes/reference.html index f54c521..b3c6048 100644 --- a/doc/html/boost_functiontypes/reference.html +++ b/doc/html/boost_functiontypes/reference.html @@ -1,22 +1,21 @@ - Reference +Reference - + - - + + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -25,7 +24,8 @@
- +
Copyright © 2004 -2007 Tobias Schwinger

diff --git a/doc/html/boost_functiontypes/reference/classification.html b/doc/html/boost_functiontypes/reference/classification.html index 7ef1d9e..e891c9c 100644 --- a/doc/html/boost_functiontypes/reference/classification.html +++ b/doc/html/boost_functiontypes/reference/classification.html @@ -1,23 +1,21 @@ - Class - templates for type classification +Class templates for type classification - + - - - + + + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -26,9 +24,9 @@
is_function
@@ -49,12 +47,11 @@
-template<typename T, typename Tag = null_tag>
+template<typename T, typename Tag = null_tag>
 struct is_function;
 

@@ -93,12 +90,11 @@

-template<typename T, typename Tag = null_tag>
+template<typename T, typename Tag = null_tag>
 struct is_function_pointer;
 

@@ -137,12 +133,11 @@

-template<typename T, typename Tag = null_tag>
+template<typename T, typename Tag = null_tag>
 struct is_function_reference;
 

@@ -181,12 +176,11 @@

-template<typename T, typename Tag = null_tag>
+template<typename T, typename Tag = null_tag>
 struct is_member_pointer;
 

@@ -225,9 +219,9 @@

 template<typename T>
 struct is_member_object_pointer;
@@ -263,12 +257,11 @@
 
 
 
-template<typename T, typename Tag = null_tag>
+template<typename T, typename Tag = null_tag>
 struct is_member_function_pointer;
 

@@ -307,12 +300,11 @@

-template<typename T, typename Tag = null_tag>
+template<typename T, typename Tag = null_tag>
 struct is_callable_builtin;
 

@@ -351,12 +343,11 @@

-template<typename T, typename Tag = null_tag>
+template<typename T, typename Tag = null_tag>
 struct is_nonmember_callable_builtin;
 

@@ -397,7 +388,11 @@ - +
Copyright © 2004 -2007 Tobias Schwinger


diff --git a/doc/html/boost_functiontypes/reference/decomposition.html b/doc/html/boost_functiontypes/reference/decomposition.html index 91ebf50..47a01a3 100644 --- a/doc/html/boost_functiontypes/reference/decomposition.html +++ b/doc/html/boost_functiontypes/reference/decomposition.html @@ -1,24 +1,21 @@ - Class templates - for type decomposition +Class templates for type decomposition - + - - - + + + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -27,9 +24,9 @@
result_type
@@ -42,9 +39,9 @@
 template<typename F>
 struct result_type;
@@ -78,9 +75,9 @@
 
 
 
 template<typename F, class ClassTransform = add_reference<_> >
 struct parameter_types;
@@ -124,9 +121,9 @@
 
 
 
 template<typename F>
 struct function_arity;
@@ -169,9 +166,9 @@
 
 
 
 template<typename T, class ClassTransform = add_reference<_> >
 struct components;
@@ -216,14 +213,17 @@
         

If T is no callable builtin type, the component types - are an empty sequence and the Tag's meaning is equivalent to the null_tag. + are an empty sequence and the Tag's meaning is equivalent to the null_tag.

- +
Copyright © 2004 -2007 Tobias Schwinger

diff --git a/doc/html/boost_functiontypes/reference/macros.html b/doc/html/boost_functiontypes/reference/macros.html index 24c18db..c1a646b 100644 --- a/doc/html/boost_functiontypes/reference/macros.html +++ b/doc/html/boost_functiontypes/reference/macros.html @@ -1,21 +1,21 @@ - Macros +Macros - + - - - + + + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -24,7 +24,8 @@
BOOST_FT_MAX_ARITY
@@ -47,9 +48,9 @@

Expands to a numeric value that describes the maximum function arity supported by the library. @@ -66,17 +67,16 @@

Expands to a sequence of ternary tuples (these data types are defined in the documentation of the Boost Preprocessor library). Each sequence element describes one calling convention specifier. The first element in each tuple is the - macro suffix for BOOST_FT_CC_*, + macro suffix for BOOST_FT_CC_*, the second element is the name of the tag that describes the calling convention and the third is the name of the specifier. The specifier is allowed to be an empty string, so the third tuple element is either BOOST_PP_EMPTY @@ -106,15 +106,13 @@

Enables a specific calling convention. * dentoes the macro suffix, as defined - by BOOST_FT_CC_NAMES - or BOOST_FT_BUILTIN_CC_NAMES. + by BOOST_FT_CC_NAMES + or BOOST_FT_BUILTIN_CC_NAMES.

The macro expands to a list of restrictions, separated by the | @@ -149,9 +147,9 @@

Defining this macro causes the following macros to be defined, if not defined already: @@ -164,9 +162,9 @@

This macro allows to change the syntax of callable builtin types. It is useful to handle the compiler specific placement of the calling convention @@ -182,9 +180,9 @@

Set to void for compilers that insist on a void parameter for nullary function types, empty by default. @@ -192,9 +190,9 @@

Disables support for cv-qualified function types. Cv-qualified function types are illegal by the current standard version, but there is a pending @@ -209,9 +207,9 @@

Makes the compiler preprocess as much as possible of the library code (rather than loading already-preprocessed header files) if defined. @@ -219,24 +217,27 @@

Makes the compiler preprocess the loop over possible names for custom calling conventions (rather than loading an already-preprocessed header file) if defined.

- This macro is defined automatically if BOOST_FT_CC_NAMES + This macro is defined automatically if BOOST_FT_CC_NAMES has been defined.

- +
Copyright © 2004 -2007 Tobias Schwinger

diff --git a/doc/html/boost_functiontypes/reference/synthesis.html b/doc/html/boost_functiontypes/reference/synthesis.html index 367db36..f0721f1 100644 --- a/doc/html/boost_functiontypes/reference/synthesis.html +++ b/doc/html/boost_functiontypes/reference/synthesis.html @@ -1,23 +1,21 @@ - Class templates - for type synthesis +Class templates for type synthesis - + - - - + + + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -26,9 +24,9 @@
function_type
@@ -41,12 +39,11 @@
-template<typename Types, typename Tag = null_tag> 
+template<typename Types, typename Tag = null_tag> 
 struct function_type;
 

@@ -84,12 +81,11 @@

-template<typename Types, typename Tag = null_tag> 
+template<typename Types, typename Tag = null_tag> 
 struct function_pointer;
 

@@ -127,12 +123,11 @@

-template<typename Types, typename Tag = null_tag> 
+template<typename Types, typename Tag = null_tag> 
 struct function_reference;
 

@@ -170,12 +165,11 @@

-template<typename Types, typename Tag = null_tag> 
+template<typename Types, typename Tag = null_tag> 
 struct member_function_pointer;
 

@@ -220,7 +214,11 @@ - +
Copyright © 2004 -2007 Tobias Schwinger


diff --git a/doc/html/boost_functiontypes/reference/tag_types.html b/doc/html/boost_functiontypes/reference/tag_types.html index eb40aac..7c8d437 100644 --- a/doc/html/boost_functiontypes/reference/tag_types.html +++ b/doc/html/boost_functiontypes/reference/tag_types.html @@ -1,22 +1,21 @@ - Tag Types +Tag Types - + - - - + + + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -25,7 +24,8 @@
variadic
@@ -54,9 +54,9 @@
 typedef unspecified variadic;
 
@@ -73,9 +73,9 @@
 typedef unspecified non_variadic;
 
@@ -91,9 +91,9 @@
 typedef unspecified default_cc;
 
@@ -109,9 +109,9 @@
 typedef unspecified const_qualified;
 
@@ -127,9 +127,9 @@
 typedef unspecified non_const;
 
@@ -145,9 +145,9 @@
 typedef unspecified volatile_qualified;
 
@@ -163,9 +163,9 @@
 typedef unspecified non_volatile;
 
@@ -181,7 +181,8 @@
 typedef unspecified non_cv;
 
@@ -199,9 +200,9 @@
 typedef unspecified const_non_volatile;
 
@@ -219,9 +220,9 @@
 typedef unspecified volatile_non_const;
 
@@ -239,9 +240,9 @@
 typedef unspecified cv_qualified;
 
@@ -259,9 +260,9 @@
 typedef unspecified null_tag;
 
@@ -277,7 +278,8 @@
+ tag +
 template<class Tag1, class Tag2, 
     class Tag3 = null_tag, class Tag4 = null_tag>
@@ -310,7 +312,11 @@
 
 
-
+
Copyright © 2004 -2007 Tobias Schwinger

diff --git a/doc/html/boost_functiontypes/use_cases.html b/doc/html/boost_functiontypes/use_cases.html index ab9e332..b28561d 100644 --- a/doc/html/boost_functiontypes/use_cases.html +++ b/doc/html/boost_functiontypes/use_cases.html @@ -1,21 +1,21 @@ - Use Cases +Use Cases - + - - + + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -24,7 +24,8 @@

Generic libraries that accept callable arguments are common in C++. Accepting a callable argument of builin type often involves a lot of repetitive code @@ -143,8 +144,7 @@ arguments from a type sequence in a single expression:

-static_cast<function_pointer<Seq>::type>(& overloaded)
+static_cast<function_pointer<Seq>::type>(& overloaded)
 

This technique can be occasionally more flexible than template argument deduction @@ -165,7 +165,11 @@ - +
Copyright © 2004 -2007 Tobias Schwinger


diff --git a/doc/html/index.html b/doc/html/index.html index 358b001..ec2fb41 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,17 +3,17 @@ Chapter 1. Boost.FunctionTypes 2.5 - + - + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -27,7 +27,7 @@
-

+

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)

@@ -46,8 +46,8 @@
- - + +

Last revised: May 13, 2007 at 13:12:48 GMT

Last revised: November 25, 2007 at 18:38:02 +0000


Next
From 6f100429eb03410cff003f7c12051949561c1ab4 Mon Sep 17 00:00:00 2001 From: Tobias Schwinger Date: Mon, 17 Mar 2008 21:42:41 +0000 Subject: [PATCH 04/15] stages trunk version for boost 1.35 [SVN r43684] --- build/Jamfile | 16 ++- build/preprocess_arity_loops.cpp | 2 +- build/preprocess_cc_names.cpp | 2 +- build/preprocess_encoding.cpp | 2 +- build/timestamps/cc_names | 1 - doc/Jamfile | 3 +- doc/function_types.qbk | 1 + .../boost_functiontypes/about_tag_types.html | 25 ++-- .../boost_functiontypes/acknowledgements.html | 26 ++-- .../boost_functiontypes/introduction.html | 38 +++--- doc/html/boost_functiontypes/rationale.html | 93 +++++++------ doc/html/boost_functiontypes/reference.html | 26 ++-- .../reference/classification.html | 101 ++++++++------- .../reference/decomposition.html | 60 ++++----- .../boost_functiontypes/reference/macros.html | 93 +++++++------ .../reference/synthesis.html | 68 +++++----- .../reference/tag_types.html | 100 +++++++------- doc/html/boost_functiontypes/use_cases.html | 28 ++-- doc/html/index.html | 18 +-- example/fast_mem_fn_example.cpp | 4 + example/interface_example.cpp | 1 + example/interpreter.hpp | 3 +- include/boost/function_types/components.hpp | 122 +++++++++--------- .../boost/function_types/detail/cv_traits.hpp | 14 +- .../function_types/detail/pp_arity_loop.hpp | 12 +- .../detail/pp_cc_loop/master.hpp | 8 +- .../detail/pp_cc_loop/preprocessed.hpp | 18 +-- .../boost/function_types/detail/pp_loop.hpp | 4 +- .../detail/pp_variate_loop/master.hpp | 2 +- .../detail/pp_variate_loop/preprocessed.hpp | 40 +++--- .../is_member_object_pointer.hpp | 4 +- .../boost/function_types/property_tags.hpp | 2 +- test/custom_ccs/member_ccs.cpp | 2 +- test/custom_ccs/member_ccs_exact.cpp | 2 +- test/custom_ccs/nonmember_ccs.cpp | 2 +- test/custom_ccs/nonmember_ccs_exact.cpp | 2 +- 36 files changed, 475 insertions(+), 470 deletions(-) diff --git a/build/Jamfile b/build/Jamfile index ce5fb17..bace553 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -2,7 +2,7 @@ # (C) Copyright Tobias Schwinger # # Use modification and distribution are subject to the boost Software License, -# Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). +# Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). # Generates preprocessed files with wave. @@ -13,18 +13,24 @@ rule wave actions wave { - $(BOOST_ROOT)/dist/bin/wave -S$(BOOST_ROOT) $(>) -o $(<) + ../../../dist/bin/wave -S../../.. $(>) -o $(<) } -make $(BOOST_ROOT)/libs/function_types/build/timestamps/arity_loops +make ../../../libs/function_types/build/timestamps/arity_loops : preprocess_arity_loops.cpp : wave ; -make $(BOOST_ROOT)/libs/function_types/build/timestamps/encoding +explicit ../../../libs/function_types/build/timestamps/arity_loops ; + +make ../../../libs/function_types/build/timestamps/encoding : preprocess_encoding.cpp : wave ; -make $(BOOST_ROOT)/libs/function_types/build/timestamps/cc_names +explicit ../../../libs/function_types/build/timestamps/encoding ; + +make ../../../libs/function_types/build/timestamps/cc_names : preprocess_cc_names.cpp : wave ; +explicit ../../../libs/function_types/build/timestamps/cc_names ; + diff --git a/build/preprocess_arity_loops.cpp b/build/preprocess_arity_loops.cpp index a045e9f..d39b65c 100644 --- a/build/preprocess_arity_loops.cpp +++ b/build/preprocess_arity_loops.cpp @@ -2,7 +2,7 @@ // (C) Copyright Tobias Schwinger // // Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). //------------------------------------------------------------------------------ diff --git a/build/preprocess_cc_names.cpp b/build/preprocess_cc_names.cpp index 39d77c5..803667c 100644 --- a/build/preprocess_cc_names.cpp +++ b/build/preprocess_cc_names.cpp @@ -2,7 +2,7 @@ // (C) Copyright Tobias Schwinger // // Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). //------------------------------------------------------------------------------ diff --git a/build/preprocess_encoding.cpp b/build/preprocess_encoding.cpp index e2e4a5e..886bec3 100644 --- a/build/preprocess_encoding.cpp +++ b/build/preprocess_encoding.cpp @@ -2,7 +2,7 @@ // (C) Copyright Tobias Schwinger // // Use modification and distribution are subject to the boost Software License, -// Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). //------------------------------------------------------------------------------ diff --git a/build/timestamps/cc_names b/build/timestamps/cc_names index e33ac14..f91091c 100644 --- a/build/timestamps/cc_names +++ b/build/timestamps/cc_names @@ -1,2 +1 @@ timestamp file - diff --git a/doc/Jamfile b/doc/Jamfile index 5b46953..fc28d86 100644 --- a/doc/Jamfile +++ b/doc/Jamfile @@ -2,7 +2,7 @@ # (C) Copyright Tobias Schwinger # # Use modification and distribution are subject to the boost Software License, -# Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt). +# Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). using quickbook ; @@ -13,6 +13,7 @@ boostbook standalone : boost.root=../../../.. boost.libraries=../../../libraries.htm + html.stylesheet=../../../../doc/html/boostbook.css chunk.first.sections=1 chunk.section.depth=2 generate.section.toc.level=2 diff --git a/doc/function_types.qbk b/doc/function_types.qbk index 0f989ae..2d97d32 100644 --- a/doc/function_types.qbk +++ b/doc/function_types.qbk @@ -1099,6 +1099,7 @@ library in one or the other way: * Jonathan Turkanis * Pavel Vozenilek * Steven Watanabe +* K. Noel Belcourt [endsect] diff --git a/doc/html/boost_functiontypes/about_tag_types.html b/doc/html/boost_functiontypes/about_tag_types.html index 2cf1396..d16c916 100644 --- a/doc/html/boost_functiontypes/about_tag_types.html +++ b/doc/html/boost_functiontypes/about_tag_types.html @@ -1,21 +1,21 @@ -About Tag Types - - + About Tag Types + + - - + + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -24,8 +24,7 @@

Boost.FunctionTypes uses tag types to encode properties that are not types per se, such as calling convention or whether a function is variadic or cv- @@ -85,11 +84,7 @@ - +
Copyright © 2004 -2007 Tobias Schwinger


diff --git a/doc/html/boost_functiontypes/acknowledgements.html b/doc/html/boost_functiontypes/acknowledgements.html index 7a2e1f3..414b34e 100644 --- a/doc/html/boost_functiontypes/acknowledgements.html +++ b/doc/html/boost_functiontypes/acknowledgements.html @@ -1,20 +1,20 @@ -Acknowledgements - - + Acknowledgements + + - + - + - - + +
Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

@@ -23,8 +23,7 @@

Thanks go to the following people for supporting the development of this library in one or the other way: @@ -72,15 +71,14 @@

  • Steven Watanabe
  • +
  • + K. Noel Belcourt +
  • - +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/introduction.html b/doc/html/boost_functiontypes/introduction.html index 306b3c8..8287622 100644 --- a/doc/html/boost_functiontypes/introduction.html +++ b/doc/html/boost_functiontypes/introduction.html @@ -1,21 +1,21 @@ -Introduction - - + Introduction + + - + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,8 +24,7 @@

    Boost.FunctionTypes provides functionality to classify, decompose and synthesize function, function pointer, function reference and pointer to member types. @@ -57,34 +56,35 @@ constant called value.

    -is_function_pointer< bool(*)(int) >::value // == true 
    +is_function_pointer< bool(*)(int) >::value // == true 
     
    -function_arity< bool(*)(int) >::value // == 1
    +function_arity< bool(*)(int) >::value // == 1
     

    Templates that encapsulate properties that are single types contain a type member called type.

    -function_type< mpl::vector<bool,int> >::type // is bool(int)
    +function_type< mpl::vector<bool,int> >::type // is bool(int)
     
    -result_type< bool(&)(int) >::type // is bool
    +result_type< bool(&)(int) >::type // is bool
     

    Templates that encapsulate properties that are type lists model an MPL-compatible type sequence.

    -parameter_types< bool(int) > // models an MPL sequence
    +parameter_types< bool(int) > // models an MPL sequence
     
    - +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/rationale.html b/doc/html/boost_functiontypes/rationale.html index e2a1952..475a795 100644 --- a/doc/html/boost_functiontypes/rationale.html +++ b/doc/html/boost_functiontypes/rationale.html @@ -1,21 +1,21 @@ -Rationale - - + Rationale + + - - + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,13 +24,12 @@
    +

    + + Error handling rationale -

    +

    The library does not define the required members of class templates in case of an error. This technique causes the compiler to stop displaying diagnostics @@ -41,10 +40,10 @@ The library's components have limited error conditions, so problematic input can be spotted easily.

    -

    - - Why MPL Sequences? -

    +

    + + Why MPL Sequences? +

    MPL provides algorithms on Sequences, so transformations (such as turning by-value parameter types into const references for optimized forwarding or computing @@ -54,20 +53,20 @@ other Boost libraries (most importantly Fusion), so another reason is interoperability.

    -

    - - Pointer +

    + + Pointer to member object types -

    +

    Despite their syntax, pointer to member object types can be seen as dereferencing functionals.

    -

    - - The +

    + + The ClassTransform template parameter -

    +

    This-pointer, this-reference or just the object (or maybe even a smart pointer to the object) plus adjustments of @@ -80,10 +79,10 @@ client to adjust the class type before the sequence is formed and then treat all parameters uniformly.

    -

    - - Why tag types? -

    +

    + + Why tag types? +

    Let's consider the alternatives.

    @@ -99,12 +98,12 @@ parameters do not work within MPL lambda expressions and can cause problems with older compilers.

    -

    - - Is +

    + + Is it safe to have the synthesis templates take a callable builtin type or an MPL sequence as the first template argument? -

    +

    Yes, but it isn't immediately obvious as the set of possible MPL sequences isn't inherently disjoint from the set of callable builtin types. @@ -114,23 +113,25 @@ idea, because builtin types are accessible before the headers that make the type a sequence have been included, which can easily violate the ODR.

    -

    - - Why +

    + + Why does the hidden this parameter count for the function arity of member functions? -

    +

    It was found preferable that the following condition holds:

    -mpl::size< parameter_types<T> >::value == function_arity<T>::value
    +mpl::size< parameter_types<T> >::value == function_arity<T>::value
     
    -

    - - Why +

    + + Why ignore top-level cv-qualifiers on pointers? -

    +

    A cv-qualified pointer is still a pointer. It usually doesn't matter and even if it does, it's a job for Boost.TypeTraits. @@ -138,11 +139,7 @@ - +
    Copyright © 2004 -2007 Tobias Schwinger


    diff --git a/doc/html/boost_functiontypes/reference.html b/doc/html/boost_functiontypes/reference.html index b3c6048..91fe6f3 100644 --- a/doc/html/boost_functiontypes/reference.html +++ b/doc/html/boost_functiontypes/reference.html @@ -1,21 +1,22 @@ -Reference - - + Reference + + - - + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,8 +25,7 @@
    - +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/reference/classification.html b/doc/html/boost_functiontypes/reference/classification.html index e891c9c..699dae9 100644 --- a/doc/html/boost_functiontypes/reference/classification.html +++ b/doc/html/boost_functiontypes/reference/classification.html @@ -1,21 +1,23 @@ -Class templates for type classification - - + Class + templates for type classification + + - - - + + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,9 +26,9 @@
    is_function
    @@ -47,11 +49,12 @@
    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_function;
     

    @@ -90,11 +93,12 @@

    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_function_pointer;
     

    @@ -133,11 +137,12 @@

    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_function_reference;
     

    @@ -176,11 +181,12 @@

    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_member_pointer;
     

    @@ -219,9 +225,9 @@

     template<typename T>
     struct is_member_object_pointer;
    @@ -257,11 +263,12 @@
     
     
     
    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_member_function_pointer;
     

    @@ -300,11 +307,12 @@

    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_callable_builtin;
     

    @@ -343,11 +351,12 @@

    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_nonmember_callable_builtin;
     

    @@ -388,11 +397,7 @@ - +
    Copyright © 2004 -2007 Tobias Schwinger


    diff --git a/doc/html/boost_functiontypes/reference/decomposition.html b/doc/html/boost_functiontypes/reference/decomposition.html index 47a01a3..bb1b431 100644 --- a/doc/html/boost_functiontypes/reference/decomposition.html +++ b/doc/html/boost_functiontypes/reference/decomposition.html @@ -1,21 +1,24 @@ -Class templates for type decomposition - - + Class templates + for type decomposition + + - - - + + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,9 +27,9 @@
    result_type
    @@ -39,9 +42,9 @@
     template<typename F>
     struct result_type;
    @@ -75,9 +78,9 @@
     
     
     
     template<typename F, class ClassTransform = add_reference<_> >
     struct parameter_types;
    @@ -121,9 +124,9 @@
     
     
     
     template<typename F>
     struct function_arity;
    @@ -166,9 +169,9 @@
     
     
     
     template<typename T, class ClassTransform = add_reference<_> >
     struct components;
    @@ -213,17 +216,14 @@
             

    If T is no callable builtin type, the component types - are an empty sequence and the Tag's meaning is equivalent to the null_tag. + are an empty sequence and the Tag's meaning is equivalent to the null_tag.

    - +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/reference/macros.html b/doc/html/boost_functiontypes/reference/macros.html index c1a646b..48cfda6 100644 --- a/doc/html/boost_functiontypes/reference/macros.html +++ b/doc/html/boost_functiontypes/reference/macros.html @@ -1,21 +1,21 @@ -Macros - - + Macros + + - - - + + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,8 +24,7 @@
    BOOST_FT_MAX_ARITY
    @@ -48,9 +47,9 @@

    Expands to a numeric value that describes the maximum function arity supported by the library. @@ -67,16 +66,17 @@

    Expands to a sequence of ternary tuples (these data types are defined in the documentation of the Boost Preprocessor library). Each sequence element describes one calling convention specifier. The first element in each tuple is the - macro suffix for BOOST_FT_CC_*, + macro suffix for BOOST_FT_CC_*, the second element is the name of the tag that describes the calling convention and the third is the name of the specifier. The specifier is allowed to be an empty string, so the third tuple element is either BOOST_PP_EMPTY @@ -106,13 +106,15 @@

    Enables a specific calling convention. * dentoes the macro suffix, as defined - by BOOST_FT_CC_NAMES - or BOOST_FT_BUILTIN_CC_NAMES. + by BOOST_FT_CC_NAMES + or BOOST_FT_BUILTIN_CC_NAMES.

    The macro expands to a list of restrictions, separated by the | @@ -147,9 +149,9 @@

    Defining this macro causes the following macros to be defined, if not defined already: @@ -162,9 +164,9 @@

    This macro allows to change the syntax of callable builtin types. It is useful to handle the compiler specific placement of the calling convention @@ -180,9 +182,9 @@

    Set to void for compilers that insist on a void parameter for nullary function types, empty by default. @@ -190,9 +192,9 @@

    Disables support for cv-qualified function types. Cv-qualified function types are illegal by the current standard version, but there is a pending @@ -207,9 +209,9 @@

    Makes the compiler preprocess as much as possible of the library code (rather than loading already-preprocessed header files) if defined. @@ -217,27 +219,24 @@

    Makes the compiler preprocess the loop over possible names for custom calling conventions (rather than loading an already-preprocessed header file) if defined.

    - This macro is defined automatically if BOOST_FT_CC_NAMES + This macro is defined automatically if BOOST_FT_CC_NAMES has been defined.

    - +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/reference/synthesis.html b/doc/html/boost_functiontypes/reference/synthesis.html index f0721f1..f1bed9f 100644 --- a/doc/html/boost_functiontypes/reference/synthesis.html +++ b/doc/html/boost_functiontypes/reference/synthesis.html @@ -1,21 +1,23 @@ -Class templates for type synthesis - - + Class templates + for type synthesis + + - - - + + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,9 +26,9 @@
    function_type
    @@ -39,11 +41,12 @@
    -template<typename Types, typename Tag = null_tag> 
    +template<typename Types, typename Tag = null_tag> 
     struct function_type;
     

    @@ -81,11 +84,12 @@

    -template<typename Types, typename Tag = null_tag> 
    +template<typename Types, typename Tag = null_tag> 
     struct function_pointer;
     

    @@ -123,11 +127,12 @@

    -template<typename Types, typename Tag = null_tag> 
    +template<typename Types, typename Tag = null_tag> 
     struct function_reference;
     

    @@ -165,11 +170,12 @@

    -template<typename Types, typename Tag = null_tag> 
    +template<typename Types, typename Tag = null_tag> 
     struct member_function_pointer;
     

    @@ -214,11 +220,7 @@ - +
    Copyright © 2004 -2007 Tobias Schwinger


    diff --git a/doc/html/boost_functiontypes/reference/tag_types.html b/doc/html/boost_functiontypes/reference/tag_types.html index 7c8d437..955296b 100644 --- a/doc/html/boost_functiontypes/reference/tag_types.html +++ b/doc/html/boost_functiontypes/reference/tag_types.html @@ -1,21 +1,22 @@ -Tag Types - - + Tag Types + + - - - + + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,8 +25,7 @@
    variadic
    @@ -54,9 +54,9 @@
     typedef unspecified variadic;
     
    @@ -73,9 +73,9 @@
     typedef unspecified non_variadic;
     
    @@ -91,9 +91,9 @@
     typedef unspecified default_cc;
     
    @@ -109,9 +109,9 @@
     typedef unspecified const_qualified;
     
    @@ -127,9 +127,9 @@
     typedef unspecified non_const;
     
    @@ -145,9 +145,9 @@
     typedef unspecified volatile_qualified;
     
    @@ -163,9 +163,9 @@
     typedef unspecified non_volatile;
     
    @@ -181,8 +181,7 @@
     typedef unspecified non_cv;
     
    @@ -200,9 +199,9 @@
     typedef unspecified const_non_volatile;
     
    @@ -220,9 +219,9 @@
     typedef unspecified volatile_non_const;
     
    @@ -240,9 +239,9 @@
     typedef unspecified cv_qualified;
     
    @@ -260,9 +259,9 @@
     typedef unspecified null_tag;
     
    @@ -278,8 +277,7 @@

    - tag -

    + tag
     template<class Tag1, class Tag2, 
         class Tag3 = null_tag, class Tag4 = null_tag>
    @@ -312,11 +310,7 @@
     
     
    -
    +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/use_cases.html b/doc/html/boost_functiontypes/use_cases.html index b28561d..803b994 100644 --- a/doc/html/boost_functiontypes/use_cases.html +++ b/doc/html/boost_functiontypes/use_cases.html @@ -1,21 +1,21 @@ -Use Cases - - + Use Cases + + - - + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,8 +24,7 @@

    Generic libraries that accept callable arguments are common in C++. Accepting a callable argument of builin type often involves a lot of repetitive code @@ -144,7 +143,8 @@ arguments from a type sequence in a single expression:

    -static_cast<function_pointer<Seq>::type>(& overloaded)
    +static_cast<function_pointer<Seq>::type>(& overloaded)
     

    This technique can be occasionally more flexible than template argument deduction @@ -165,11 +165,7 @@ - +
    Copyright © 2004 -2007 Tobias Schwinger


    diff --git a/doc/html/index.html b/doc/html/index.html index ec2fb41..2f32aa2 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -2,18 +2,18 @@ Chapter 1. Boost.FunctionTypes 2.5 - - + + - + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -27,7 +27,7 @@
    -

    +

    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)

    @@ -46,8 +46,8 @@
    - - + +

    Last revised: November 25, 2007 at 18:38:02 +0000

    Last revised: November 05, 2007 at 18:24:58 +0100


    Next
    diff --git a/example/fast_mem_fn_example.cpp b/example/fast_mem_fn_example.cpp index efe66a1..381ee14 100644 --- a/example/fast_mem_fn_example.cpp +++ b/example/fast_mem_fn_example.cpp @@ -101,7 +101,11 @@ int main() setup_test(v); t.restart(); +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400) do_test(v, BOOST_EXAMPLE_FAST_MEM_FN(& test::id)); +#else // MSVC<8 does not like the implementation of the deduction macro: + do_test(v, ::example::fast_mem_fn< int (test::*)() const, & test::id >()); +#endif time1 = t.elapsed(); std::cout << "fast_mem_fn | " << time1 << std::endl; diff --git a/example/interface_example.cpp b/example/interface_example.cpp index d4f66bb..6b7f8d9 100644 --- a/example/interface_example.cpp +++ b/example/interface_example.cpp @@ -8,6 +8,7 @@ // See interface.hpp in this directory for details. #include +#include #include "interface.hpp" diff --git a/example/interpreter.hpp b/example/interpreter.hpp index 9e75bf7..72cd78b 100644 --- a/example/interpreter.hpp +++ b/example/interpreter.hpp @@ -133,8 +133,9 @@ namespace example void apply(Function func, token_parser & parser, Args const & args) { typedef typename mpl::deref::type arg_type; + typedef typename mpl::next::type next_iter_type; - invoker::type, To>::apply + interpreter::invoker::apply ( func, parser, fusion::push_back(args, parser.get()) ); } }; diff --git a/include/boost/function_types/components.hpp b/include/boost/function_types/components.hpp index b975307..a4432c5 100644 --- a/include/boost/function_types/components.hpp +++ b/include/boost/function_types/components.hpp @@ -120,13 +120,14 @@ namespace boost template < typename Components , typename IfTagged - , typename ThenTag + , typename ThenTag + , typename DefaultBase = components_non_func_base > struct retagged_if : mpl::if_ < detail::represents_impl , detail::changed_tag - , components_non_func_base + , DefaultBase >::type { }; @@ -213,14 +214,71 @@ namespace boost : components_impl { }; -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x565)) + + template + struct member_obj_ptr_result + { typedef T & type; }; + + template + struct member_obj_ptr_result + { typedef T const & type; }; + + template + struct member_obj_ptr_result + { typedef T volatile & type; }; + + template + struct member_obj_ptr_result + { typedef T const volatile & type; }; + + template + struct member_obj_ptr_result + { typedef T & type; }; + + template + struct member_obj_ptr_result + { typedef T & type; }; + + template + struct member_obj_ptr_result + { typedef T & type; }; + + template + struct member_obj_ptr_result + { typedef T & type; }; + + template + struct member_obj_ptr_components + : member_object_pointer_base + { + typedef function_types::components type; + typedef components_mpl_sequence_tag tag; + + typedef mpl::integral_c function_arity; + + typedef mpl::vector2< typename detail::member_obj_ptr_result::type, + typename detail::class_transform::type > types; + }; + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x565)) +# define BOOST_FT_variations BOOST_FT_pointer|BOOST_FT_member_pointer + + template + struct components_impl + : member_obj_ptr_components + { }; + +#else +# define BOOST_FT_variations BOOST_FT_pointer + // This workaround removes the member pointer from the type to allow // detection of member function pointers with BCC. template struct components_impl : detail::retagged_if < detail::components_impl::type *, L> - , pointer_tag, /* --> */ member_pointer_tag > + , pointer_tag, /* --> */ member_function_pointer_tag + , member_obj_ptr_components > { }; // BCC lets us test the cv-qualification of a function type by template @@ -349,65 +407,13 @@ namespace boost struct components_bcc : mpl::if_ < detail::represents_impl< detail::components_impl - , member_pointer_tag> + , member_function_pointer_tag> , detail::mfp_components,T,OrigT,L> , detail::components_impl >::type { }; -// TODO: add data member support for Borland - -# define BOOST_FT_variations BOOST_FT_pointer -#else // end of BORLAND WORKAROUND -# define BOOST_FT_variations BOOST_FT_pointer|BOOST_FT_member_pointer - - template - struct member_obj_ptr_result - { typedef T & type; }; - - template - struct member_obj_ptr_result - { typedef T const & type; }; - - template - struct member_obj_ptr_result - { typedef T volatile & type; }; - - template - struct member_obj_ptr_result - { typedef T const volatile & type; }; - - template - struct member_obj_ptr_result - { typedef T & type; }; - - template - struct member_obj_ptr_result - { typedef T & type; }; - - template - struct member_obj_ptr_result - { typedef T & type; }; - - template - struct member_obj_ptr_result - { typedef T & type; }; - - - template - struct components_impl - : member_object_pointer_base - { - typedef function_types::components type; - typedef components_mpl_sequence_tag tag; - - typedef mpl::integral_c function_arity; - - typedef mpl::vector2< typename detail::member_obj_ptr_result::type, - typename detail::class_transform::type > types; - }; - -#endif +#endif // end of BORLAND WORKAROUND #define BOOST_FT_al_path boost/function_types/detail/components_impl #include diff --git a/include/boost/function_types/detail/cv_traits.hpp b/include/boost/function_types/detail/cv_traits.hpp index b48452d..242f45b 100644 --- a/include/boost/function_types/detail/cv_traits.hpp +++ b/include/boost/function_types/detail/cv_traits.hpp @@ -12,7 +12,8 @@ #include #include -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + || BOOST_WORKAROUND(__BORLANDC__, <= 0x582) # include # include # include @@ -22,10 +23,8 @@ namespace boost { namespace function_types { namespace detail { -namespace ft = boost::function_types; - - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +#if ! (defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + || BOOST_WORKAROUND(__BORLANDC__, <= 0x582)) template struct cv_traits { typedef non_cv tag; typedef T type; }; @@ -109,12 +108,13 @@ struct cv_code { static T _t; BOOST_STATIC_CONSTANT(std::size_t, value = - sizeof(ft::detail::switch_cv(ft::detail::ref_to_ptr(_t) ) )); + sizeof(::boost::function_types::detail::switch_cv( + ::boost::function_types::detail::ref_to_ptr(_t) ) )); }; template struct cv_traits { - typedef typename ft::detail::cv_tag_impl< + typedef typename boost::function_types::detail::cv_tag_impl< ::boost::function_types::detail::cv_code::value >::type tag; diff --git a/include/boost/function_types/detail/pp_arity_loop.hpp b/include/boost/function_types/detail/pp_arity_loop.hpp index 91dfb7c..b6dbff5 100644 --- a/include/boost/function_types/detail/pp_arity_loop.hpp +++ b/include/boost/function_types/detail/pp_arity_loop.hpp @@ -81,14 +81,16 @@ BOOST_PP_EXPAND(#) include BOOST_FT_AL_PREPROCESSED # include # endif +# define BOOST_FT_AL_INCLUDE_FILE + # define BOOST_FT_ARITY_LOOP_PREFIX 1 -# include BOOST_PP_EXPAND() +# include BOOST_FT_AL_INCLUDE_FILE # undef BOOST_FT_ARITY_LOOP_PREFIX # if !BOOST_PP_IS_ITERATING -# define BOOST_PP_FILENAME_1 +# define BOOST_PP_FILENAME_1 BOOST_FT_AL_INCLUDE_FILE # elif BOOST_PP_ITERATION_DEPTH() == 1 -# define BOOST_PP_FILENAME_2 +# define BOOST_PP_FILENAME_2 BOOST_FT_AL_INCLUDE_FILE # else # error "loops nested too deeply" # endif @@ -133,8 +135,10 @@ BOOST_PP_EXPAND(#) include BOOST_FT_AL_PREPROCESSED # undef BOOST_FT_type # define BOOST_FT_ARITY_LOOP_SUFFIX 1 -# include BOOST_PP_EXPAND() +# include BOOST_FT_AL_INCLUDE_FILE # undef BOOST_FT_ARITY_LOOP_SUFFIX + +# undef BOOST_FT_AL_INCLUDE_FILE # endif # undef BOOST_FT_FROM_ARITY diff --git a/include/boost/function_types/detail/pp_cc_loop/master.hpp b/include/boost/function_types/detail/pp_cc_loop/master.hpp index 5a6d6c4..60e958c 100644 --- a/include/boost/function_types/detail/pp_cc_loop/master.hpp +++ b/include/boost/function_types/detail/pp_cc_loop/master.hpp @@ -42,7 +42,7 @@ # define BOOST_FT_cc_name implicit_cc # define BOOST_FT_cc BOOST_PP_EMPTY # define BOOST_FT_cond callable_builtin -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_cc_file # undef BOOST_FT_cond # undef BOOST_FT_cc_name # undef BOOST_FT_cc @@ -54,7 +54,7 @@ BOOST_PP_EXPAND(#) define BOOST_FT_cc_name implicit_cc BOOST_PP_EXPAND(#) define BOOST_FT_cc BOOST_PP_EMPTY BOOST_PP_EXPAND(#) define BOOST_FT_cond callable_builtin #define _() -BOOST_PP_EXPAND(#) include BOOST_PP_EXPAND _()( ) +BOOST_PP_EXPAND(#) include BOOST_FT_cc_file #undef _ BOOST_PP_EXPAND(#) undef BOOST_FT_cond BOOST_PP_EXPAND(#) undef BOOST_FT_cc_name @@ -85,7 +85,7 @@ BOOST_PP_EXPAND(#) endif # if BOOST_FT_cond # define BOOST_FT_config_valid 1 -# include BOOST_PP_EXPAND() +# include BOOST_FT_cc_file # endif # undef BOOST_FT_cond @@ -121,7 +121,7 @@ BOOST_PP_EXPAND(#) define BOOST_FT_cond BOOST_FT_cc_cond_v BOOST_PP_EXPAND(#) if BOOST_FT_cond BOOST_PP_EXPAND(#) define BOOST_FT_config_valid 1 #define _() -BOOST_PP_EXPAND(#) include BOOST_PP_EXPAND _()() +BOOST_PP_EXPAND(#) include BOOST_FT_cc_file #undef _ BOOST_PP_EXPAND(#) endif diff --git a/include/boost/function_types/detail/pp_cc_loop/preprocessed.hpp b/include/boost/function_types/detail/pp_cc_loop/preprocessed.hpp index 87c6031..da4079c 100644 --- a/include/boost/function_types/detail/pp_cc_loop/preprocessed.hpp +++ b/include/boost/function_types/detail/pp_cc_loop/preprocessed.hpp @@ -15,7 +15,7 @@ # define BOOST_FT_cond BOOST_FT_CC_IMPLICIT # if BOOST_FT_cond # define BOOST_FT_config_valid 1 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_cc_file # endif # undef BOOST_FT_cond # undef BOOST_FT_cc_name @@ -27,7 +27,7 @@ # define BOOST_FT_cond BOOST_FT_CC_CDECL # if BOOST_FT_cond # define BOOST_FT_config_valid 1 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_cc_file # endif # undef BOOST_FT_cond # undef BOOST_FT_cc_name @@ -39,7 +39,7 @@ # define BOOST_FT_cond BOOST_FT_CC_STDCALL # if BOOST_FT_cond # define BOOST_FT_config_valid 1 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_cc_file # endif # undef BOOST_FT_cond # undef BOOST_FT_cc_name @@ -51,7 +51,7 @@ # define BOOST_FT_cond BOOST_FT_CC_PASCAL # if BOOST_FT_cond # define BOOST_FT_config_valid 1 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_cc_file # endif # undef BOOST_FT_cond # undef BOOST_FT_cc_name @@ -63,7 +63,7 @@ # define BOOST_FT_cond BOOST_FT_CC_FASTCALL # if BOOST_FT_cond # define BOOST_FT_config_valid 1 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_cc_file # endif # undef BOOST_FT_cond # undef BOOST_FT_cc_name @@ -75,7 +75,7 @@ # define BOOST_FT_cond BOOST_FT_CC_CLRCALL # if BOOST_FT_cond # define BOOST_FT_config_valid 1 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_cc_file # endif # undef BOOST_FT_cond # undef BOOST_FT_cc_name @@ -87,7 +87,7 @@ # define BOOST_FT_cond BOOST_FT_CC_THISCALL # if BOOST_FT_cond # define BOOST_FT_config_valid 1 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_cc_file # endif # undef BOOST_FT_cond # undef BOOST_FT_cc_name @@ -99,7 +99,7 @@ # define BOOST_FT_cond BOOST_FT_CC_IMPLICIT_THISCALL # if BOOST_FT_cond # define BOOST_FT_config_valid 1 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_cc_file # endif # undef BOOST_FT_cond # undef BOOST_FT_cc_name @@ -110,7 +110,7 @@ # define BOOST_FT_cc_name implicit_cc # define BOOST_FT_cc BOOST_PP_EMPTY # define BOOST_FT_cond 0x00000001 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_cc_file # undef BOOST_FT_cond # undef BOOST_FT_cc_name # undef BOOST_FT_cc diff --git a/include/boost/function_types/detail/pp_loop.hpp b/include/boost/function_types/detail/pp_loop.hpp index 7521cf2..7d8c347 100644 --- a/include/boost/function_types/detail/pp_loop.hpp +++ b/include/boost/function_types/detail/pp_loop.hpp @@ -28,9 +28,9 @@ #if defined(BOOST_FT_al_path) # define BOOST_FT_cc_file \ - boost/function_types/detail/pp_variate_loop/preprocessed.hpp + # define BOOST_FT_variate_file \ - boost/function_types/detail/pp_arity_loop.hpp + # ifndef BOOST_FT_type_function # define BOOST_FT_type_function(cc,name) BOOST_FT_SYNTAX( \ diff --git a/include/boost/function_types/detail/pp_variate_loop/master.hpp b/include/boost/function_types/detail/pp_variate_loop/master.hpp index cf27477..5026342 100644 --- a/include/boost/function_types/detail/pp_variate_loop/master.hpp +++ b/include/boost/function_types/detail/pp_variate_loop/master.hpp @@ -140,7 +140,7 @@ BOOST_PP_EXPAND(#) define BOOST_FT_cv const volatile # endif # endif BOOST_PP_EXPAND(#) define BOOST_FT_flags BOOST_PP_SLOT(1) -BOOST_PP_EXPAND(#) include BOOST_PP_EXPAND BOOST_PP_EMPTY()() +BOOST_PP_EXPAND(#) include BOOST_FT_variate_file BOOST_PP_EXPAND(#) undef BOOST_FT_cv BOOST_PP_EXPAND(#) undef BOOST_FT_ell diff --git a/include/boost/function_types/detail/pp_variate_loop/preprocessed.hpp b/include/boost/function_types/detail/pp_variate_loop/preprocessed.hpp index d87d519..7e7c4f9 100644 --- a/include/boost/function_types/detail/pp_variate_loop/preprocessed.hpp +++ b/include/boost/function_types/detail/pp_variate_loop/preprocessed.hpp @@ -15,7 +15,7 @@ # define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM # define BOOST_FT_cv # define BOOST_FT_flags 519 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -28,7 +28,7 @@ # define BOOST_FT_nullary_param # define BOOST_FT_cv # define BOOST_FT_flags 263 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -42,7 +42,7 @@ # define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM # define BOOST_FT_cv const # define BOOST_FT_flags 1543 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -55,7 +55,7 @@ # define BOOST_FT_nullary_param # define BOOST_FT_cv const # define BOOST_FT_flags 1287 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -68,7 +68,7 @@ # define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM # define BOOST_FT_cv volatile # define BOOST_FT_flags 2567 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -81,7 +81,7 @@ # define BOOST_FT_nullary_param # define BOOST_FT_cv volatile # define BOOST_FT_flags 2311 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -94,7 +94,7 @@ # define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM # define BOOST_FT_cv const volatile # define BOOST_FT_flags 3591 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -107,7 +107,7 @@ # define BOOST_FT_nullary_param # define BOOST_FT_cv const volatile # define BOOST_FT_flags 3335 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -123,7 +123,7 @@ # define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM # define BOOST_FT_cv # define BOOST_FT_flags 523 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -136,7 +136,7 @@ # define BOOST_FT_nullary_param # define BOOST_FT_cv # define BOOST_FT_flags 267 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -151,7 +151,7 @@ # define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM # define BOOST_FT_cv # define BOOST_FT_flags 531 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -164,7 +164,7 @@ # define BOOST_FT_nullary_param # define BOOST_FT_cv # define BOOST_FT_flags 275 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -181,7 +181,7 @@ # define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM # define BOOST_FT_cv # define BOOST_FT_flags 609 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -194,7 +194,7 @@ # define BOOST_FT_nullary_param # define BOOST_FT_cv # define BOOST_FT_flags 353 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -207,7 +207,7 @@ # define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM # define BOOST_FT_cv const # define BOOST_FT_flags 1633 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -220,7 +220,7 @@ # define BOOST_FT_nullary_param # define BOOST_FT_cv const # define BOOST_FT_flags 1377 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -233,7 +233,7 @@ # define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM # define BOOST_FT_cv volatile # define BOOST_FT_flags 2657 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -246,7 +246,7 @@ # define BOOST_FT_nullary_param # define BOOST_FT_cv volatile # define BOOST_FT_flags 2401 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -259,7 +259,7 @@ # define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM # define BOOST_FT_cv const volatile # define BOOST_FT_flags 3681 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param @@ -272,7 +272,7 @@ # define BOOST_FT_nullary_param # define BOOST_FT_cv const volatile # define BOOST_FT_flags 3425 -# include BOOST_PP_EXPAND ( ) +# include BOOST_FT_variate_file # undef BOOST_FT_cv # undef BOOST_FT_ell # undef BOOST_FT_nullary_param diff --git a/include/boost/function_types/is_member_object_pointer.hpp b/include/boost/function_types/is_member_object_pointer.hpp index fbf4850..77527d9 100644 --- a/include/boost/function_types/is_member_object_pointer.hpp +++ b/include/boost/function_types/is_member_object_pointer.hpp @@ -24,10 +24,10 @@ namespace boost < function_types::components , detail::member_object_pointer_tag > { - BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_member_object_pointer,(T,Tag)) + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_member_object_pointer,(T)) }; } - BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::is_member_object_pointer) + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,function_types::is_member_object_pointer) } #endif diff --git a/include/boost/function_types/property_tags.hpp b/include/boost/function_types/property_tags.hpp index b241e1a..bbc64d5 100644 --- a/include/boost/function_types/property_tags.hpp +++ b/include/boost/function_types/property_tags.hpp @@ -141,7 +141,7 @@ template struct extract #include namespace boost { namespace function_types { -#define BOOST_FT_cc_file boost/function_types/detail/pp_tags/cc_tag.hpp +#define BOOST_FT_cc_file #include } } // namespace boost::function_types diff --git a/test/custom_ccs/member_ccs.cpp b/test/custom_ccs/member_ccs.cpp index 727b38b..11f9392 100644 --- a/test/custom_ccs/member_ccs.cpp +++ b/test/custom_ccs/member_ccs.cpp @@ -14,7 +14,7 @@ #include #ifndef BOOST_FT_CC_STDCALL -# error "test not supported with this compiler" +# error "test not supported with this compiler/platform" #endif namespace ft = boost::function_types; diff --git a/test/custom_ccs/member_ccs_exact.cpp b/test/custom_ccs/member_ccs_exact.cpp index 2decf14..413b133 100644 --- a/test/custom_ccs/member_ccs_exact.cpp +++ b/test/custom_ccs/member_ccs_exact.cpp @@ -14,7 +14,7 @@ #include #ifndef BOOST_FT_CC_STDCALL -# error "test not supported with this compiler" +# error "test not supported with this compiler/platform" #endif namespace ft = boost::function_types; diff --git a/test/custom_ccs/nonmember_ccs.cpp b/test/custom_ccs/nonmember_ccs.cpp index 98bf3d5..81681ff 100644 --- a/test/custom_ccs/nonmember_ccs.cpp +++ b/test/custom_ccs/nonmember_ccs.cpp @@ -16,7 +16,7 @@ #include #ifndef BOOST_FT_CC_STDCALL -# error "test not supported with this compiler" +# error "test not supported with this compiler/platform" #endif namespace ft = boost::function_types; diff --git a/test/custom_ccs/nonmember_ccs_exact.cpp b/test/custom_ccs/nonmember_ccs_exact.cpp index 31f73c0..d6db300 100644 --- a/test/custom_ccs/nonmember_ccs_exact.cpp +++ b/test/custom_ccs/nonmember_ccs_exact.cpp @@ -16,7 +16,7 @@ #include #ifndef BOOST_FT_CC_STDCALL -# error "test not supported with this compiler" +# error "test not supported with this compiler/platform" #endif namespace ft = boost::function_types; From cde937faaa0136699dcfec47757837c3806d42dd Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sat, 24 Jan 2009 18:57:20 +0000 Subject: [PATCH 05/15] merge of cmake build files from trunk per beman [SVN r50756] --- CMakeLists.txt | 21 ++++++++++++++ module.cmake | 1 + test/CMakeLists.txt | 70 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 module.cmake create mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d29e160 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,21 @@ +#---------------------------------------------------------------------------- +# This file was automatically generated from the original CMakeLists.txt file +# Add a variable to hold the headers for the library +set (lib_headers + function_types +) + +# Add a library target to the build system +boost_library_project( + function_types + # SRCDIRS + TESTDIRS test + HEADERS ${lib_headers} + # DOCDIRS + # DESCRIPTION + MODULARIZED + # AUTHORS + # MAINTAINERS +) + + diff --git a/module.cmake b/module.cmake new file mode 100644 index 0000000..9943033 --- /dev/null +++ b/module.cmake @@ -0,0 +1 @@ +boost_module(function_types DEPENDS mpl detail) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..2f03877 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,70 @@ +# Get the boost dependencies for the tests +boost_additional_test_dependencies(function_types BOOST_DEPENDS test fusion) + +boost_test_compile(is_function classification/is_function.cpp) +boost_test_compile(is_function_pointer classification/is_function_pointer.cpp) +boost_test_compile(is_function_reference classification/is_function_reference.cpp) +boost_test_compile(is_member_function_pointer classification/is_member_function_pointer.cpp) +boost_test_compile(is_member_object_pointer classification/is_member_object_pointer.cpp) +boost_test_compile(is_callable_builtin classification/is_callable_builtin.cpp) +boost_test_compile(is_nonmember_callable_builtin classification/is_nonmember_callable_builtin.cpp) +boost_test_compile(is_member_pointer classification/is_member_pointer.cpp) + +boost_test_compile(is_cv_mem_func_ptr classification/is_cv_mem_func_ptr.cpp) +boost_test_compile(is_variadic classification/is_variadic.cpp) +boost_test_compile(is_cv_pointer classification/is_cv_pointer.cpp) + # [ compile classification/is_cv_function.cpp) + +# Decomposition + +boost_test_compile(components decomposition/components.cpp) +boost_test_compile(result_type decomposition/result_type.cpp) +boost_test_compile(function_arity decomposition/function_arity.cpp) +boost_test_compile(parameter_types decomposition/parameter_types.cpp) + +boost_test_compile(components_seq decomposition/components_seq.cpp) +boost_test_compile(class_type_transform decomposition/class_type_transform.cpp) + +boost_test_compile_fail(result_type_fail decomposition/result_type_fail.cpp) +boost_test_compile_fail(parameter_types_fail decomposition/parameter_types_fail.cpp) +boost_test_compile_fail(function_arity_fail decomposition/function_arity_fail.cpp) + +# Synthesis + +boost_test_compile(function_type synthesis/function_type.cpp) +boost_test_compile(function_pointer synthesis/function_pointer.cpp) +boost_test_compile(function_reference synthesis/function_reference.cpp) +boost_test_compile(member_function_pointer synthesis/member_function_pointer.cpp) +boost_test_compile(member_object_pointer synthesis/member_object_pointer.cpp) + +boost_test_compile(transformation synthesis/transformation.cpp) +boost_test_compile(mem_func_ptr_cv1 synthesis/mem_func_ptr_cv1.cpp) +boost_test_compile(mem_func_ptr_cv2 synthesis/mem_func_ptr_cv2.cpp) +boost_test_compile(mem_func_ptr_cv_ptr_to_this synthesis/mem_func_ptr_cv_ptr_to_this.cpp) +boost_test_compile(variadic_function_synthesis synthesis/variadic_function_synthesis.cpp) + # [ compile synthesis/cv_function_synthesis.cpp) + +# Reconfiguration + +boost_test_compile(preprocessing_mode reconfiguration/preprocessing_mode.cpp) +boost_test_compile(partial_arity_preprocessing reconfiguration/partial_arity_preprocessing.cpp) +boost_test_compile(cc_preprocessing reconfiguration/cc_preprocessing.cpp) + +# Custom calling conventions +boost_test_compile(nonmember_ccs custom_ccs/nonmember_ccs.cpp) +boost_test_compile(nonmember_ccs_exact custom_ccs/nonmember_ccs_exact.cpp) +message(STATUS "Function_Types/test/custom_ccs/member_ccs.cpp Needs love") +#boost_test_compile(member_ccs custom_ccs/member_ccs.cpp) +message(STATUS "Function_Types/test/custom_ccs/member_ccs_exact.cpp Needs love") +#boost_test_compile(member_ccs_exact custom_ccs/member_ccs_exact.cpp) + + +# Code from the examples +# Include the "example" directory +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/example") +boost_test_compile(interpreter_example ../example/interpreter_example.cpp) +boost_test_compile(result_of_example ../example/result_of_example.cpp) +boost_test_compile(interface_example ../example/interface_example.cpp) +message(STATUS "Function_Types/example/fast_mem_fn_example.cpp Needs love") +#boost_test_compile(fast_mem_fn_example ../example/fast_mem_fn_example.cpp) +boost_test_compile(macro_type_args_example ../example/macro_type_args_example.cpp) From f451e18ef278d182e65e47d8ebf4d68d526d73d6 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Wed, 22 Jul 2009 21:51:01 +0000 Subject: [PATCH 06/15] Add basic copyright/license to keep cmake out of the inspection report [SVN r55095] --- CMakeLists.txt | 6 ++++++ test/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d29e160..6e83c47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,9 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# #---------------------------------------------------------------------------- # This file was automatically generated from the original CMakeLists.txt file # Add a variable to hold the headers for the library diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2f03877..1a5a0c3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,9 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# # Get the boost dependencies for the tests boost_additional_test_dependencies(function_types BOOST_DEPENDS test fusion) From 91f47b7bc629b116562d35b05c3476bf16f34d42 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 30 Aug 2009 10:23:32 +0000 Subject: [PATCH 07/15] Merged patchset 44631 from trunk. Resolves parenthesis warnings on GCC 4.3. Fixes #2321. [SVN r55872] --- .../function_types/detail/pp_retag_default_cc/master.hpp | 4 ++-- .../detail/pp_retag_default_cc/preprocessed.hpp | 4 ++-- include/boost/function_types/detail/pp_tags/master.hpp | 2 +- include/boost/function_types/detail/pp_tags/preprocessed.hpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/boost/function_types/detail/pp_retag_default_cc/master.hpp b/include/boost/function_types/detail/pp_retag_default_cc/master.hpp index f97d385..865efce 100644 --- a/include/boost/function_types/detail/pp_retag_default_cc/master.hpp +++ b/include/boost/function_types/detail/pp_retag_default_cc/master.hpp @@ -30,8 +30,8 @@ namespace detail # include BOOST_PP_ASSIGN_SLOT(1) BOOST_STATIC_CONSTANT(bits_t, value = ( - ::boost::function_types::detail::bits::value & BOOST_FT_default_cc - | ::boost::function_types::detail::bits::value & BOOST_PP_SLOT(1) + (::boost::function_types::detail::bits::value & BOOST_FT_default_cc) + | (::boost::function_types::detail::bits::value & BOOST_PP_SLOT(1)) )); }; diff --git a/include/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp b/include/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp index c21a4fd..72666d0 100644 --- a/include/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp +++ b/include/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp @@ -15,8 +15,8 @@ namespace detail template struct selector_bits { BOOST_STATIC_CONSTANT(bits_t, value = ( -::boost::function_types::detail::bits ::value & 0x00008000 -| ::boost::function_types::detail::bits ::value & 802 +(::boost::function_types::detail::bits ::value & 0x00008000) +| (::boost::function_types::detail::bits ::value & 802) )); }; template struct default_cc_tag; diff --git a/include/boost/function_types/detail/pp_tags/master.hpp b/include/boost/function_types/detail/pp_tags/master.hpp index 783b93c..9cce212 100644 --- a/include/boost/function_types/detail/pp_tags/master.hpp +++ b/include/boost/function_types/detail/pp_tags/master.hpp @@ -82,7 +82,7 @@ namespace detail { ); BOOST_STATIC_CONSTANT(bits_t, combined_bits = - LHS_bits & ~RHS_mask | RHS_bits + (LHS_bits & ~RHS_mask) | RHS_bits ); BOOST_STATIC_CONSTANT(bits_t, combined_mask = diff --git a/include/boost/function_types/detail/pp_tags/preprocessed.hpp b/include/boost/function_types/detail/pp_tags/preprocessed.hpp index 811d62a..823c3cc 100644 --- a/include/boost/function_types/detail/pp_tags/preprocessed.hpp +++ b/include/boost/function_types/detail/pp_tags/preprocessed.hpp @@ -53,7 +53,7 @@ BOOST_STATIC_CONSTANT(bool, match = RHS_bits == (LHS_bits & RHS_mask & (RHS_bits | ~0x000000ff)) ); BOOST_STATIC_CONSTANT(bits_t, combined_bits = -LHS_bits & ~RHS_mask | RHS_bits +(LHS_bits & ~RHS_mask) | RHS_bits ); BOOST_STATIC_CONSTANT(bits_t, combined_mask = LHS_mask | RHS_mask From 6ba2a45f5f1fbb06e6b1b3f5d5b49fd67d5b7b9b Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sat, 17 Oct 2009 01:10:45 +0000 Subject: [PATCH 08/15] rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release. [SVN r56941] --- CMakeLists.txt | 27 ---------------- module.cmake | 1 - test/CMakeLists.txt | 76 --------------------------------------------- 3 files changed, 104 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 module.cmake delete mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 6e83c47..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright Troy D. Straszheim -# -# Distributed under the Boost Software License, Version 1.0. -# See http://www.boost.org/LICENSE_1_0.txt -# -#---------------------------------------------------------------------------- -# This file was automatically generated from the original CMakeLists.txt file -# Add a variable to hold the headers for the library -set (lib_headers - function_types -) - -# Add a library target to the build system -boost_library_project( - function_types - # SRCDIRS - TESTDIRS test - HEADERS ${lib_headers} - # DOCDIRS - # DESCRIPTION - MODULARIZED - # AUTHORS - # MAINTAINERS -) - - diff --git a/module.cmake b/module.cmake deleted file mode 100644 index 9943033..0000000 --- a/module.cmake +++ /dev/null @@ -1 +0,0 @@ -boost_module(function_types DEPENDS mpl detail) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 1a5a0c3..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,76 +0,0 @@ -# -# Copyright Troy D. Straszheim -# -# Distributed under the Boost Software License, Version 1.0. -# See http://www.boost.org/LICENSE_1_0.txt -# -# Get the boost dependencies for the tests -boost_additional_test_dependencies(function_types BOOST_DEPENDS test fusion) - -boost_test_compile(is_function classification/is_function.cpp) -boost_test_compile(is_function_pointer classification/is_function_pointer.cpp) -boost_test_compile(is_function_reference classification/is_function_reference.cpp) -boost_test_compile(is_member_function_pointer classification/is_member_function_pointer.cpp) -boost_test_compile(is_member_object_pointer classification/is_member_object_pointer.cpp) -boost_test_compile(is_callable_builtin classification/is_callable_builtin.cpp) -boost_test_compile(is_nonmember_callable_builtin classification/is_nonmember_callable_builtin.cpp) -boost_test_compile(is_member_pointer classification/is_member_pointer.cpp) - -boost_test_compile(is_cv_mem_func_ptr classification/is_cv_mem_func_ptr.cpp) -boost_test_compile(is_variadic classification/is_variadic.cpp) -boost_test_compile(is_cv_pointer classification/is_cv_pointer.cpp) - # [ compile classification/is_cv_function.cpp) - -# Decomposition - -boost_test_compile(components decomposition/components.cpp) -boost_test_compile(result_type decomposition/result_type.cpp) -boost_test_compile(function_arity decomposition/function_arity.cpp) -boost_test_compile(parameter_types decomposition/parameter_types.cpp) - -boost_test_compile(components_seq decomposition/components_seq.cpp) -boost_test_compile(class_type_transform decomposition/class_type_transform.cpp) - -boost_test_compile_fail(result_type_fail decomposition/result_type_fail.cpp) -boost_test_compile_fail(parameter_types_fail decomposition/parameter_types_fail.cpp) -boost_test_compile_fail(function_arity_fail decomposition/function_arity_fail.cpp) - -# Synthesis - -boost_test_compile(function_type synthesis/function_type.cpp) -boost_test_compile(function_pointer synthesis/function_pointer.cpp) -boost_test_compile(function_reference synthesis/function_reference.cpp) -boost_test_compile(member_function_pointer synthesis/member_function_pointer.cpp) -boost_test_compile(member_object_pointer synthesis/member_object_pointer.cpp) - -boost_test_compile(transformation synthesis/transformation.cpp) -boost_test_compile(mem_func_ptr_cv1 synthesis/mem_func_ptr_cv1.cpp) -boost_test_compile(mem_func_ptr_cv2 synthesis/mem_func_ptr_cv2.cpp) -boost_test_compile(mem_func_ptr_cv_ptr_to_this synthesis/mem_func_ptr_cv_ptr_to_this.cpp) -boost_test_compile(variadic_function_synthesis synthesis/variadic_function_synthesis.cpp) - # [ compile synthesis/cv_function_synthesis.cpp) - -# Reconfiguration - -boost_test_compile(preprocessing_mode reconfiguration/preprocessing_mode.cpp) -boost_test_compile(partial_arity_preprocessing reconfiguration/partial_arity_preprocessing.cpp) -boost_test_compile(cc_preprocessing reconfiguration/cc_preprocessing.cpp) - -# Custom calling conventions -boost_test_compile(nonmember_ccs custom_ccs/nonmember_ccs.cpp) -boost_test_compile(nonmember_ccs_exact custom_ccs/nonmember_ccs_exact.cpp) -message(STATUS "Function_Types/test/custom_ccs/member_ccs.cpp Needs love") -#boost_test_compile(member_ccs custom_ccs/member_ccs.cpp) -message(STATUS "Function_Types/test/custom_ccs/member_ccs_exact.cpp Needs love") -#boost_test_compile(member_ccs_exact custom_ccs/member_ccs_exact.cpp) - - -# Code from the examples -# Include the "example" directory -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/example") -boost_test_compile(interpreter_example ../example/interpreter_example.cpp) -boost_test_compile(result_of_example ../example/result_of_example.cpp) -boost_test_compile(interface_example ../example/interface_example.cpp) -message(STATUS "Function_Types/example/fast_mem_fn_example.cpp Needs love") -#boost_test_compile(fast_mem_fn_example ../example/fast_mem_fn_example.cpp) -boost_test_compile(macro_type_args_example ../example/macro_type_args_example.cpp) From 5f0d9dd0a8f5745b4a11b747c5991040f18be292 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 20 Nov 2009 10:13:51 +0000 Subject: [PATCH 09/15] Merge [44130],[44131] fix a typo in libs/function_types. [SVN r57810] --- doc/function_types.qbk | 2 +- .../boost_functiontypes/about_tag_types.html | 23 +++-- .../boost_functiontypes/acknowledgements.html | 21 ++-- .../boost_functiontypes/introduction.html | 36 +++---- doc/html/boost_functiontypes/rationale.html | 91 ++++++++--------- doc/html/boost_functiontypes/reference.html | 24 +++-- .../reference/classification.html | 99 +++++++++---------- .../reference/decomposition.html | 58 +++++------ .../boost_functiontypes/reference/macros.html | 93 ++++++++--------- .../reference/synthesis.html | 66 ++++++------- .../reference/tag_types.html | 98 +++++++++--------- doc/html/boost_functiontypes/use_cases.html | 26 ++--- doc/html/index.html | 16 +-- 13 files changed, 337 insertions(+), 316 deletions(-) diff --git a/doc/function_types.qbk b/doc/function_types.qbk index 2d97d32..598a7b5 100644 --- a/doc/function_types.qbk +++ b/doc/function_types.qbk @@ -897,7 +897,7 @@ definition of [^BOOST_FT_CC_NAMES]: [section:BOOST_FT_CC BOOST_FT\_CC\_*] -Enables a specific calling convention. * dentoes the macro suffix, as +Enables a specific calling convention. * denotes the macro suffix, as defined by [link boost_functiontypes.reference.macros.BOOST_FT_CC_NAMES [^BOOST_FT_CC_NAMES]] or diff --git a/doc/html/boost_functiontypes/about_tag_types.html b/doc/html/boost_functiontypes/about_tag_types.html index d16c916..7d07a85 100644 --- a/doc/html/boost_functiontypes/about_tag_types.html +++ b/doc/html/boost_functiontypes/about_tag_types.html @@ -1,21 +1,21 @@ - About Tag Types +About Tag Types - + - - + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,7 +24,8 @@

    Boost.FunctionTypes uses tag types to encode properties that are not types per se, such as calling convention or whether a function is variadic or cv- @@ -84,7 +85,11 @@ - +
    Copyright © 2004 -2007 Tobias Schwinger


    diff --git a/doc/html/boost_functiontypes/acknowledgements.html b/doc/html/boost_functiontypes/acknowledgements.html index 414b34e..b0498b7 100644 --- a/doc/html/boost_functiontypes/acknowledgements.html +++ b/doc/html/boost_functiontypes/acknowledgements.html @@ -1,20 +1,20 @@ - Acknowledgements +Acknowledgements - + - + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -23,7 +23,8 @@

    Thanks go to the following people for supporting the development of this library in one or the other way: @@ -78,7 +79,11 @@ - +
    Copyright © 2004 -2007 Tobias Schwinger


    diff --git a/doc/html/boost_functiontypes/introduction.html b/doc/html/boost_functiontypes/introduction.html index 8287622..cdaf6b1 100644 --- a/doc/html/boost_functiontypes/introduction.html +++ b/doc/html/boost_functiontypes/introduction.html @@ -1,21 +1,21 @@ - Introduction +Introduction - + - + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,7 +24,8 @@

    Boost.FunctionTypes provides functionality to classify, decompose and synthesize function, function pointer, function reference and pointer to member types. @@ -56,35 +57,34 @@ constant called value.

    -is_function_pointer< bool(*)(int) >::value // == true 
    +is_function_pointer< bool(*)(int) >::value // == true 
     
    -function_arity< bool(*)(int) >::value // == 1
    +function_arity< bool(*)(int) >::value // == 1
     

    Templates that encapsulate properties that are single types contain a type member called type.

    -function_type< mpl::vector<bool,int> >::type // is bool(int)
    +function_type< mpl::vector<bool,int> >::type // is bool(int)
     
    -result_type< bool(&)(int) >::type // is bool
    +result_type< bool(&)(int) >::type // is bool
     

    Templates that encapsulate properties that are type lists model an MPL-compatible type sequence.

    -parameter_types< bool(int) > // models an MPL sequence
    +parameter_types< bool(int) > // models an MPL sequence
     
    - +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/rationale.html b/doc/html/boost_functiontypes/rationale.html index 475a795..5ba69d0 100644 --- a/doc/html/boost_functiontypes/rationale.html +++ b/doc/html/boost_functiontypes/rationale.html @@ -1,21 +1,21 @@ - Rationale +Rationale - + - - + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,12 +24,13 @@
    +

    + + Error handling rationale -

    +

    The library does not define the required members of class templates in case of an error. This technique causes the compiler to stop displaying diagnostics @@ -40,10 +41,10 @@ The library's components have limited error conditions, so problematic input can be spotted easily.

    -

    - - Why MPL Sequences? -

    +

    + + Why MPL Sequences? +

    MPL provides algorithms on Sequences, so transformations (such as turning by-value parameter types into const references for optimized forwarding or computing @@ -53,20 +54,20 @@ other Boost libraries (most importantly Fusion), so another reason is interoperability.

    -

    - - Pointer +

    + + Pointer to member object types -

    +

    Despite their syntax, pointer to member object types can be seen as dereferencing functionals.

    -

    - - The +

    + + The ClassTransform template parameter -

    +

    This-pointer, this-reference or just the object (or maybe even a smart pointer to the object) plus adjustments of @@ -79,10 +80,10 @@ client to adjust the class type before the sequence is formed and then treat all parameters uniformly.

    -

    - - Why tag types? -

    +

    + + Why tag types? +

    Let's consider the alternatives.

    @@ -98,12 +99,12 @@ parameters do not work within MPL lambda expressions and can cause problems with older compilers.

    -

    - - Is +

    + + Is it safe to have the synthesis templates take a callable builtin type or an MPL sequence as the first template argument? -

    +

    Yes, but it isn't immediately obvious as the set of possible MPL sequences isn't inherently disjoint from the set of callable builtin types. @@ -113,25 +114,23 @@ idea, because builtin types are accessible before the headers that make the type a sequence have been included, which can easily violate the ODR.

    -

    - - Why +

    + + Why does the hidden this parameter count for the function arity of member functions? -

    +

    It was found preferable that the following condition holds:

    -mpl::size< parameter_types<T> >::value == function_arity<T>::value
    +mpl::size< parameter_types<T> >::value == function_arity<T>::value
     
    -

    - - Why +

    + + Why ignore top-level cv-qualifiers on pointers? -

    +

    A cv-qualified pointer is still a pointer. It usually doesn't matter and even if it does, it's a job for Boost.TypeTraits. @@ -139,7 +138,11 @@ - +
    Copyright © 2004 -2007 Tobias Schwinger


    diff --git a/doc/html/boost_functiontypes/reference.html b/doc/html/boost_functiontypes/reference.html index 91fe6f3..eacf2d4 100644 --- a/doc/html/boost_functiontypes/reference.html +++ b/doc/html/boost_functiontypes/reference.html @@ -1,22 +1,21 @@ - Reference +Reference - + - - + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -25,7 +24,8 @@
    - +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/reference/classification.html b/doc/html/boost_functiontypes/reference/classification.html index 699dae9..2f49b79 100644 --- a/doc/html/boost_functiontypes/reference/classification.html +++ b/doc/html/boost_functiontypes/reference/classification.html @@ -1,23 +1,21 @@ - Class - templates for type classification +Class templates for type classification - + - - - + + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -26,9 +24,9 @@
    is_function
    @@ -49,12 +47,11 @@
    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_function;
     

    @@ -93,12 +90,11 @@

    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_function_pointer;
     

    @@ -137,12 +133,11 @@

    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_function_reference;
     

    @@ -181,12 +176,11 @@

    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_member_pointer;
     

    @@ -225,9 +219,9 @@

     template<typename T>
     struct is_member_object_pointer;
    @@ -263,12 +257,11 @@
     
     
     
    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_member_function_pointer;
     

    @@ -307,12 +300,11 @@

    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_callable_builtin;
     

    @@ -351,12 +343,11 @@

    -template<typename T, typename Tag = null_tag>
    +template<typename T, typename Tag = null_tag>
     struct is_nonmember_callable_builtin;
     

    @@ -397,7 +388,11 @@ - +
    Copyright © 2004 -2007 Tobias Schwinger


    diff --git a/doc/html/boost_functiontypes/reference/decomposition.html b/doc/html/boost_functiontypes/reference/decomposition.html index bb1b431..b4447e4 100644 --- a/doc/html/boost_functiontypes/reference/decomposition.html +++ b/doc/html/boost_functiontypes/reference/decomposition.html @@ -1,24 +1,21 @@ - Class templates - for type decomposition +Class templates for type decomposition - + - - - + + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -27,9 +24,9 @@
    result_type
    @@ -42,9 +39,9 @@
     template<typename F>
     struct result_type;
    @@ -78,9 +75,9 @@
     
     
     
     template<typename F, class ClassTransform = add_reference<_> >
     struct parameter_types;
    @@ -124,9 +121,9 @@
     
     
     
     template<typename F>
     struct function_arity;
    @@ -169,9 +166,9 @@
     
     
     
     template<typename T, class ClassTransform = add_reference<_> >
     struct components;
    @@ -216,14 +213,17 @@
             

    If T is no callable builtin type, the component types - are an empty sequence and the Tag's meaning is equivalent to the null_tag. + are an empty sequence and the Tag's meaning is equivalent to the null_tag.

    - +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/reference/macros.html b/doc/html/boost_functiontypes/reference/macros.html index 48cfda6..ea3f1eb 100644 --- a/doc/html/boost_functiontypes/reference/macros.html +++ b/doc/html/boost_functiontypes/reference/macros.html @@ -1,21 +1,21 @@ - Macros +Macros - + - - - + + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,7 +24,8 @@
    BOOST_FT_MAX_ARITY
    @@ -47,9 +48,9 @@

    Expands to a numeric value that describes the maximum function arity supported by the library. @@ -66,17 +67,16 @@

    Expands to a sequence of ternary tuples (these data types are defined in the documentation of the Boost Preprocessor library). Each sequence element describes one calling convention specifier. The first element in each tuple is the - macro suffix for BOOST_FT_CC_*, + macro suffix for BOOST_FT_CC_*, the second element is the name of the tag that describes the calling convention and the third is the name of the specifier. The specifier is allowed to be an empty string, so the third tuple element is either BOOST_PP_EMPTY @@ -106,15 +106,13 @@

    - Enables a specific calling convention. * dentoes the macro suffix, as defined - by BOOST_FT_CC_NAMES - or BOOST_FT_BUILTIN_CC_NAMES. + Enables a specific calling convention. * denotes the macro suffix, as defined + by BOOST_FT_CC_NAMES + or BOOST_FT_BUILTIN_CC_NAMES.

    The macro expands to a list of restrictions, separated by the | @@ -149,9 +147,9 @@

    Defining this macro causes the following macros to be defined, if not defined already: @@ -164,9 +162,9 @@

    This macro allows to change the syntax of callable builtin types. It is useful to handle the compiler specific placement of the calling convention @@ -182,9 +180,9 @@

    Set to void for compilers that insist on a void parameter for nullary function types, empty by default. @@ -192,9 +190,9 @@

    Disables support for cv-qualified function types. Cv-qualified function types are illegal by the current standard version, but there is a pending @@ -209,9 +207,9 @@

    Makes the compiler preprocess as much as possible of the library code (rather than loading already-preprocessed header files) if defined. @@ -219,24 +217,27 @@

    Makes the compiler preprocess the loop over possible names for custom calling conventions (rather than loading an already-preprocessed header file) if defined.

    - This macro is defined automatically if BOOST_FT_CC_NAMES + This macro is defined automatically if BOOST_FT_CC_NAMES has been defined.

    - +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/reference/synthesis.html b/doc/html/boost_functiontypes/reference/synthesis.html index f1bed9f..fdf12ab 100644 --- a/doc/html/boost_functiontypes/reference/synthesis.html +++ b/doc/html/boost_functiontypes/reference/synthesis.html @@ -1,23 +1,21 @@ - Class templates - for type synthesis +Class templates for type synthesis - + - - - + + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -26,9 +24,9 @@
    function_type
    @@ -41,12 +39,11 @@
    -template<typename Types, typename Tag = null_tag> 
    +template<typename Types, typename Tag = null_tag> 
     struct function_type;
     

    @@ -84,12 +81,11 @@

    -template<typename Types, typename Tag = null_tag> 
    +template<typename Types, typename Tag = null_tag> 
     struct function_pointer;
     

    @@ -127,12 +123,11 @@

    -template<typename Types, typename Tag = null_tag> 
    +template<typename Types, typename Tag = null_tag> 
     struct function_reference;
     

    @@ -170,12 +165,11 @@

    -template<typename Types, typename Tag = null_tag> 
    +template<typename Types, typename Tag = null_tag> 
     struct member_function_pointer;
     

    @@ -220,7 +214,11 @@ - +
    Copyright © 2004 -2007 Tobias Schwinger


    diff --git a/doc/html/boost_functiontypes/reference/tag_types.html b/doc/html/boost_functiontypes/reference/tag_types.html index 955296b..847d74f 100644 --- a/doc/html/boost_functiontypes/reference/tag_types.html +++ b/doc/html/boost_functiontypes/reference/tag_types.html @@ -1,22 +1,21 @@ - Tag Types +Tag Types - + - - - + + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -25,7 +24,8 @@
    variadic
    @@ -54,9 +54,9 @@
     typedef unspecified variadic;
     
    @@ -73,9 +73,9 @@
     typedef unspecified non_variadic;
     
    @@ -91,9 +91,9 @@
     typedef unspecified default_cc;
     
    @@ -109,9 +109,9 @@
     typedef unspecified const_qualified;
     
    @@ -127,9 +127,9 @@
     typedef unspecified non_const;
     
    @@ -145,9 +145,9 @@
     typedef unspecified volatile_qualified;
     
    @@ -163,9 +163,9 @@
     typedef unspecified non_volatile;
     
    @@ -181,7 +181,8 @@
     typedef unspecified non_cv;
     
    @@ -199,9 +200,9 @@
     typedef unspecified const_non_volatile;
     
    @@ -219,9 +220,9 @@
     typedef unspecified volatile_non_const;
     
    @@ -239,9 +240,9 @@
     typedef unspecified cv_qualified;
     
    @@ -259,9 +260,9 @@
     typedef unspecified null_tag;
     
    @@ -277,7 +278,8 @@
    + tag +
     template<class Tag1, class Tag2, 
         class Tag3 = null_tag, class Tag4 = null_tag>
    @@ -310,7 +312,11 @@
     
     
    -
    +
    Copyright © 2004 -2007 Tobias Schwinger

    diff --git a/doc/html/boost_functiontypes/use_cases.html b/doc/html/boost_functiontypes/use_cases.html index 803b994..8cee449 100644 --- a/doc/html/boost_functiontypes/use_cases.html +++ b/doc/html/boost_functiontypes/use_cases.html @@ -1,21 +1,21 @@ - Use Cases +Use Cases - + - - + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,7 +24,8 @@

    Generic libraries that accept callable arguments are common in C++. Accepting a callable argument of builin type often involves a lot of repetitive code @@ -143,8 +144,7 @@ arguments from a type sequence in a single expression:

    -static_cast<function_pointer<Seq>::type>(& overloaded)
    +static_cast<function_pointer<Seq>::type>(& overloaded)
     

    This technique can be occasionally more flexible than template argument deduction @@ -165,7 +165,11 @@ - +
    Copyright © 2004 -2007 Tobias Schwinger


    diff --git a/doc/html/index.html b/doc/html/index.html index 2f32aa2..c95f3f7 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,17 +3,17 @@ Chapter 1. Boost.FunctionTypes 2.5 - + - + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -27,7 +27,7 @@
    -

    +

    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)

    @@ -46,8 +46,8 @@
    - - + +

    Last revised: November 05, 2007 at 18:24:58 +0100

    Last revised: March 14, 2008 at 18:36:46 +0000


    Next
    From 4e48421f9d92556545d0287bcd9f6b89ccfd9cf7 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 20 Nov 2009 10:17:49 +0000 Subject: [PATCH 10/15] Merge [41554] Using central stylesheet now. [SVN r57811] --- doc/html/boostbook.css | 528 ----------------------------------------- 1 file changed, 528 deletions(-) delete mode 100644 doc/html/boostbook.css diff --git a/doc/html/boostbook.css b/doc/html/boostbook.css deleted file mode 100644 index 858d43c..0000000 --- a/doc/html/boostbook.css +++ /dev/null @@ -1,528 +0,0 @@ -/*============================================================================= - Copyright (c) 2004 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ - -/*============================================================================= - Body defaults -=============================================================================*/ - - body - { - margin: 1em; - font-family: sans-serif; - } - -/*============================================================================= - Paragraphs -=============================================================================*/ - - p - { - text-align: left; - font-size: 10pt; - line-height: 1.15; - } - -/*============================================================================= - Program listings -=============================================================================*/ - - /* Code on paragraphs */ - p tt.computeroutput - { - font-size: 9pt; - } - - pre.synopsis - { - font-size: 90%; - margin: 1pc 4% 0pc 4%; - padding: 0.5pc 0.5pc 0.5pc 0.5pc; - } - - .programlisting, - .screen - { - font-size: 9pt; - display: block; - margin: 1pc 4% 0pc 4%; - padding: 0.5pc 0.5pc 0.5pc 0.5pc; - } - - /* Program listings in tables don't get borders */ - td .programlisting, - td .screen - { - margin: 0pc 0pc 0pc 0pc; - padding: 0pc 0pc 0pc 0pc; - } - -/*============================================================================= - Headings -=============================================================================*/ - - h1, h2, h3, h4, h5, h6 - { - text-align: left; - margin: 1em 0em 0.5em 0em; - font-weight: bold; - } - - h1 { font: 140% } - h2 { font: bold 140% } - h3 { font: bold 130% } - h4 { font: bold 120% } - h5 { font: italic 110% } - h6 { font: italic 100% } - - /* Top page titles */ - title, - h1.title, - h2.title - h3.title, - h4.title, - h5.title, - h6.title, - .refentrytitle - { - font-weight: bold; - margin-bottom: 1pc; - } - - h1.title { font-size: 140% } - h2.title { font-size: 140% } - h3.title { font-size: 130% } - h4.title { font-size: 120% } - h5.title { font-size: 110% } - h6.title { font-size: 100% } - - .section h1 - { - margin: 0em 0em 0.5em 0em; - font-size: 140%; - } - - .section h2 { font-size: 140% } - .section h3 { font-size: 130% } - .section h4 { font-size: 120% } - .section h5 { font-size: 110% } - .section h6 { font-size: 100% } - - /* Code on titles */ - h1 tt.computeroutput { font-size: 140% } - h2 tt.computeroutput { font-size: 140% } - h3 tt.computeroutput { font-size: 130% } - h4 tt.computeroutput { font-size: 120% } - h5 tt.computeroutput { font-size: 110% } - h6 tt.computeroutput { font-size: 100% } - -/*============================================================================= - Author -=============================================================================*/ - - h3.author - { - font-size: 100% - } - -/*============================================================================= - Lists -=============================================================================*/ - - li - { - font-size: 10pt; - line-height: 1.3; - } - - /* Unordered lists */ - ul - { - text-align: left; - } - - /* Ordered lists */ - ol - { - text-align: left; - } - -/*============================================================================= - Links -=============================================================================*/ - - a - { - text-decoration: none; /* no underline */ - } - - a:hover - { - text-decoration: underline; - } - -/*============================================================================= - Spirit style navigation -=============================================================================*/ - - .spirit-nav - { - text-align: right; - } - - .spirit-nav a - { - color: white; - padding-left: 0.5em; - } - - .spirit-nav img - { - border-width: 0px; - } - -/*============================================================================= - Table of contents -=============================================================================*/ - - .toc - { - margin: 1pc 4% 0pc 4%; - padding: 0.1pc 1pc 0.1pc 1pc; - font-size: 80%; - line-height: 1.15; - } - - .boost-toc - { - float: right; - padding: 0.5pc; - } - -/*============================================================================= - Tables -=============================================================================*/ - - .table-title, - div.table p.title - { - margin-left: 4%; - padding-right: 0.5em; - padding-left: 0.5em; - } - - .informaltable table, - .table table - { - width: 92%; - margin-left: 4%; - margin-right: 4%; - } - - div.informaltable table, - div.table table - { - padding: 4px; - } - - /* Table Cells */ - div.informaltable table tr td, - div.table table tr td - { - padding: 0.5em; - text-align: left; - font-size: 9pt; - } - - div.informaltable table tr th, - div.table table tr th - { - padding: 0.5em 0.5em 0.5em 0.5em; - border: 1pt solid white; - font-size: 80%; - } - -/*============================================================================= - Blurbs -=============================================================================*/ - - div.note, - div.tip, - div.important, - div.caution, - div.warning, - div.sidebar - { - font-size: 9pt; /* A little bit smaller than the main text */ - line-height: 1.2; - display: block; - margin: 1pc 4% 0pc 4%; - padding: 0.5pc 0.5pc 0.0pc 0.5pc; - } - - div.sidebar img - { - padding: 1pt; - } - -/*============================================================================= - Callouts -=============================================================================*/ - .line_callout_bug img - { - float: left; - position:relative; - left: 4px; - top: -12px; - clear: left; - margin-left:-22px; - } - - .callout_bug img - { - } - -/*============================================================================= - Variable Lists -=============================================================================*/ - - /* Make the terms in definition lists bold */ - div.variablelist dl dt, - span.term - { - font-weight: bold; - font-size: 10pt; - } - - div.variablelist table tbody tr td - { - text-align: left; - vertical-align: top; - padding: 0em 2em 0em 0em; - font-size: 10pt; - margin: 0em 0em 0.5em 0em; - line-height: 1; - } - - div.variablelist dl dt - { - margin-bottom: 0.2em; - } - - div.variablelist dl dd - { - margin: 0em 0em 0.5em 2em; - font-size: 10pt; - } - - div.variablelist table tbody tr td p, - div.variablelist dl dd p - { - margin: 0em 0em 0.5em 0em; - line-height: 1; - } - -/*============================================================================= - Misc -=============================================================================*/ - - /* Title of books and articles in bibliographies */ - span.title - { - font-style: italic; - } - - span.underline - { - text-decoration: underline; - } - - span.strikethrough - { - text-decoration: line-through; - } - - /* Copyright, Legal Notice */ - div div.legalnotice p - { - text-align: left - } - -/*============================================================================= - Colors -=============================================================================*/ - - @media screen - { - /* Links */ - a - { - color: #005a9c; - } - - a:visited - { - color: #9c5a9c; - } - - h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, - h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover, - h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited - { - text-decoration: none; /* no underline */ - color: #000000; - } - - /* Syntax Highlighting */ - .keyword { color: #0000AA; } - .identifier { color: #000000; } - .special { color: #707070; } - .preprocessor { color: #402080; } - .char { color: teal; } - .comment { color: #800000; } - .string { color: teal; } - .number { color: teal; } - .white_bkd { background-color: #FFFFFF; } - .dk_grey_bkd { background-color: #999999; } - - /* Copyright, Legal Notice */ - .copyright - { - color: #666666; - font-size: small; - } - - div div.legalnotice p - { - color: #666666; - } - - /* Program listing */ - pre.synopsis - { - border: 1px solid #DCDCDC; - } - - .programlisting, - .screen - { - border: 1px solid #DCDCDC; - } - - td .programlisting, - td .screen - { - border: 0px solid #DCDCDC; - } - - /* Blurbs */ - div.note, - div.tip, - div.important, - div.caution, - div.warning, - div.sidebar - { - border: 1px solid #DCDCDC; - } - - /* Table of contents */ - .toc - { - border: 1px solid #DCDCDC; - } - - /* Tables */ - div.informaltable table tr td, - div.table table tr td - { - border: 1px solid #DCDCDC; - } - - div.informaltable table tr th, - div.table table tr th - { - background-color: #F0F0F0; - border: 1px solid #DCDCDC; - } - - /* Misc */ - span.highlight - { - color: #00A000; - } - } - - @media print - { - /* Links */ - a - { - color: black; - } - - a:visited - { - color: black; - } - - .spirit-nav - { - display: none; - } - - /* Program listing */ - pre.synopsis - { - border: 1px solid gray; - } - - .programlisting, - .screen - { - border: 1px solid gray; - } - - td .programlisting, - td .screen - { - border: 0px solid #DCDCDC; - } - - /* Table of contents */ - .toc - { - border: 1px solid gray; - } - - .informaltable table, - .table table - { - border: 1px solid gray; - border-collapse: collapse; - } - - /* Tables */ - div.informaltable table tr td, - div.table table tr td - { - border: 1px solid gray; - } - - div.informaltable table tr th, - div.table table tr th - { - border: 1px solid gray; - } - - /* Misc */ - span.highlight - { - font-weight: bold; - } - } From a7f9fa0eda5403bf8a09643b6769a58c1fa0c1ee Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 26 Jun 2010 12:30:09 +0000 Subject: [PATCH 11/15] Merge documentation fixes. * Use `doc/src/*.css` instead of `doc/html/*.css`. * Remove wiki and people directories. * Some documentation fixes. * Left out `minimal.css` changes and boostbook changes because of clashes. [SVN r63347] --- doc/Jamfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/Jamfile b/doc/Jamfile index fc28d86..ffa96b1 100644 --- a/doc/Jamfile +++ b/doc/Jamfile @@ -12,8 +12,6 @@ boostbook standalone function_types : boost.root=../../../.. - boost.libraries=../../../libraries.htm - html.stylesheet=../../../../doc/html/boostbook.css chunk.first.sections=1 chunk.section.depth=2 generate.section.toc.level=2 From 7e239167da7666a40bf6bd1faf4c5ea9c28f5d96 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 2 Jul 2010 08:27:42 +0000 Subject: [PATCH 12/15] Merge documentation update. [SVN r63517] --- .../boost_functiontypes/about_tag_types.html | 39 ++- .../boost_functiontypes/acknowledgements.html | 116 ++++----- .../boost_functiontypes/introduction.html | 55 ++-- doc/html/boost_functiontypes/rationale.html | 43 ++-- doc/html/boost_functiontypes/reference.html | 24 +- .../reference/classification.html | 242 ++++++++---------- .../reference/decomposition.html | 130 +++++----- .../boost_functiontypes/reference/macros.html | 84 +++--- .../reference/synthesis.html | 118 ++++----- .../reference/tag_types.html | 134 ++++------ doc/html/boost_functiontypes/use_cases.html | 39 ++- doc/html/index.html | 30 +-- 12 files changed, 489 insertions(+), 565 deletions(-) diff --git a/doc/html/boost_functiontypes/about_tag_types.html b/doc/html/boost_functiontypes/about_tag_types.html index 7d07a85..7b9e5ec 100644 --- a/doc/html/boost_functiontypes/about_tag_types.html +++ b/doc/html/boost_functiontypes/about_tag_types.html @@ -1,11 +1,11 @@ - + About Tag Types - - - - + + + + @@ -13,16 +13,16 @@ - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -35,8 +35,7 @@ These tags can be used to determine whether one property of a type has a particular value.

    -
    -is_function<int(...), variadic>::value // == true
    +
    is_function<int(...), variadic>::value // == true
     is_function<int()   , variadic>::value // == false
     

    @@ -45,22 +44,19 @@ is a callable builtin type, is a compound property tag that describes F. The tag class template can be used to combine property tags.

    -
    -tag<non_const,default_cc> // combination of two properties
    +
    tag<non_const,default_cc> // combination of two properties
     

    When several values for the same property are specified in tag's argument list, only the rightmost one is used; others are ignored.

    -
    -tag<components<F>, default_cc> // overrides F's calling convention property
    +
    tag<components<F>, default_cc> // overrides F's calling convention property
     

    When compound property tag is specified to analyse a type, all of its component properties must match.

    -
    -is_member_function_pointer< F, tag<const_qualified,default_cc> >::value
    +
    is_member_function_pointer< F, tag<const_qualified,default_cc> >::value
     // true for 
     //   F = void(a_class::*)() const
     // false for
    @@ -71,8 +67,7 @@
           Default values are selected for properties not specified by the tag in the
           context of type synthesis.
         

    -
    -// given S = mpl::vector<int,a_class const &>
    +
    // given S = mpl::vector<int,a_class const &>
     
     member_function_pointer<S>::type // is int (a_class::*)() const
     // note: the cv-qualification is picked based on the class type,
    @@ -85,7 +80,7 @@
     
    -

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/boost_functiontypes/acknowledgements.html b/doc/html/boost_functiontypes/acknowledgements.html index b0498b7..4f7d0fe 100644 --- a/doc/html/boost_functiontypes/acknowledgements.html +++ b/doc/html/boost_functiontypes/acknowledgements.html @@ -1,27 +1,27 @@ - + Acknowledgements - - - - + + + + - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHome +PrevUpHome
    -
    +
    @@ -29,57 +29,57 @@ Thanks go to the following people for supporting the development of this library in one or the other way:

    -
      -
    • - David Abrahams -
    • -
    • - Tom Brinkman -
    • -
    • - Aleksey Gurtovoy -
    • -
    • - Jody Hagins -
    • -
    • - Hartmut Kaiser -
    • -
    • - Andy Little -
    • -
    • - John Maddock -
    • -
    • - Paul Mensonides -
    • -
    • - Alexander Nasonov -
    • -
    • - Richard Smith -
    • -
    • - Rob Stewart -
    • -
    • - Jonathan Turkanis -
    • -
    • - Pavel Vozenilek -
    • -
    • - Steven Watanabe -
    • -
    • - K. Noel Belcourt -
    • +
        +
      • + David Abrahams +
      • +
      • + Tom Brinkman +
      • +
      • + Aleksey Gurtovoy +
      • +
      • + Jody Hagins +
      • +
      • + Hartmut Kaiser +
      • +
      • + Andy Little +
      • +
      • + John Maddock +
      • +
      • + Paul Mensonides +
      • +
      • + Alexander Nasonov +
      • +
      • + Richard Smith +
      • +
      • + Rob Stewart +
      • +
      • + Jonathan Turkanis +
      • +
      • + Pavel Vozenilek +
      • +
      • + Steven Watanabe +
      • +
      • + K. Noel Belcourt +
    -

    -PrevUpHome +PrevUpHome
    diff --git a/doc/html/boost_functiontypes/introduction.html b/doc/html/boost_functiontypes/introduction.html index cdaf6b1..2110a58 100644 --- a/doc/html/boost_functiontypes/introduction.html +++ b/doc/html/boost_functiontypes/introduction.html @@ -1,28 +1,28 @@ - + Introduction - - - - - + + + + + - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -37,16 +37,16 @@

    In particular, the library can be used to:

    -
      -
    • - test whether a type is a specific callable, builtin type, -
    • -
    • - extract all component properties from callable, builtin types, and -
    • -
    • - create callable, builtin types from specified properties. -
    • +
        +
      • + test whether a type is a specific callable, builtin type, +
      • +
      • + extract all component properties from callable, builtin types, and +
      • +
      • + create callable, builtin types from specified properties. +

      The library is designed to work well with other Boost libraries and uses well-accepted @@ -56,8 +56,7 @@ Templates that encapsulate boolean or numeric properties define a static member constant called value.

      -
      -is_function_pointer< bool(*)(int) >::value // == true 
      +
      is_function_pointer< bool(*)(int) >::value // == true 
       
       function_arity< bool(*)(int) >::value // == 1
       
      @@ -65,8 +64,7 @@ Templates that encapsulate properties that are single types contain a type member called type.

      -
      -function_type< mpl::vector<bool,int> >::type // is bool(int)
      +
      function_type< mpl::vector<bool,int> >::type // is bool(int)
       
       result_type< bool(&)(int) >::type // is bool
       
      @@ -74,13 +72,12 @@ Templates that encapsulate properties that are type lists model an MPL-compatible type sequence.

      -
      -parameter_types< bool(int) > // models an MPL sequence
      +
      parameter_types< bool(int) > // models an MPL sequence
       
    -

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/boost_functiontypes/rationale.html b/doc/html/boost_functiontypes/rationale.html index 5ba69d0..8918fed 100644 --- a/doc/html/boost_functiontypes/rationale.html +++ b/doc/html/boost_functiontypes/rationale.html @@ -1,11 +1,11 @@ - + Rationale - - - - + + + + @@ -13,21 +13,21 @@ - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    - + Error handling rationale

    @@ -42,7 +42,7 @@ can be spotted easily.

    - + Why MPL Sequences?

    @@ -55,7 +55,7 @@ so another reason is interoperability.

    - + Pointer to member object types

    @@ -64,7 +64,7 @@ functionals.

    - + The ClassTransform template parameter

    @@ -81,7 +81,7 @@ all parameters uniformly.

    - + Why tag types?

    @@ -100,7 +100,7 @@ with older compilers.

    - + Is it safe to have the synthesis templates take a callable builtin type or an MPL sequence as the first template argument? @@ -115,7 +115,7 @@ type a sequence have been included, which can easily violate the ODR.

    - + Why does the hidden this parameter count for the function arity of member functions? @@ -123,11 +123,10 @@

    It was found preferable that the following condition holds:

    -
    -mpl::size< parameter_types<T> >::value == function_arity<T>::value
    +
    mpl::size< parameter_types<T> >::value == function_arity<T>::value
     

    - + Why ignore top-level cv-qualifiers on pointers?

    @@ -138,7 +137,7 @@

    -

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/boost_functiontypes/reference.html b/doc/html/boost_functiontypes/reference.html index eacf2d4..512e56f 100644 --- a/doc/html/boost_functiontypes/reference.html +++ b/doc/html/boost_functiontypes/reference.html @@ -1,11 +1,11 @@ - + Reference - - - - + + + + @@ -13,16 +13,16 @@ - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -39,7 +39,7 @@
    -

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/boost_functiontypes/reference/classification.html b/doc/html/boost_functiontypes/reference/classification.html index 2f49b79..41a5d9f 100644 --- a/doc/html/boost_functiontypes/reference/classification.html +++ b/doc/html/boost_functiontypes/reference/classification.html @@ -1,10 +1,10 @@ - + Class templates for type classification - - - + + + @@ -13,16 +13,16 @@ - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    -
    +
    -
    -template<typename T, typename Tag = null_tag>
    +
    template<typename T, typename Tag = null_tag>
     struct is_function;
     

    Header

    -
    -#include <boost/function_types/is_function.hpp>
    +
    #include <boost/function_types/is_function.hpp>
     

    T

    - Type to analyze -

    + Type to analyze +

    Tag

    - Further properties required for a positive result -

    + Further properties required for a positive result +

    is_function<T,Tag>

    - Predicate value as MPL - - Integral - Constant -

    + Predicate value as MPL + - Integral + Constant +

    is_function<T,Tag>::value

    - Constant boolean value -

    + Constant boolean value +

    @@ -88,42 +86,40 @@ properties as specified by a property tag.

    -
    +
    -
    -template<typename T, typename Tag = null_tag>
    +
    template<typename T, typename Tag = null_tag>
     struct is_function_pointer;
     

    Header

    -
    -#include <boost/function_types/is_function_pointer.hpp>
    +
    #include <boost/function_types/is_function_pointer.hpp>
     

    T

    - Type to analyze -

    + Type to analyze +

    Tag

    - Further properties required for a positive result -

    + Further properties required for a positive result +

    is_function_pointer<T,Tag>

    - Predicate value MPL - - Integral - Constant -

    + Predicate value MPL + - Integral + Constant +

    is_function_pointer<T,Tag>::value

    - Constant boolean value -

    + Constant boolean value +

    @@ -131,42 +127,40 @@ properties as specified by a property tag.

    -
    +
    -
    -template<typename T, typename Tag = null_tag>
    +
    template<typename T, typename Tag = null_tag>
     struct is_function_reference;
     

    Header

    -
    -#include <boost/function_types/is_function_reference.hpp>
    +
    #include <boost/function_types/is_function_reference.hpp>
     

    T

    - Type to analyze -

    + Type to analyze +

    Tag

    - Further properties required for a positive result -

    + Further properties required for a positive result +

    is_function_reference<T,Tag>

    - Predicate value MPL - - Integral - Constant -

    + Predicate value MPL + - Integral + Constant +

    is_function_reference<T,Tag>::value

    - Constant boolean value -

    + Constant boolean value +

    @@ -174,42 +168,40 @@ additional properties as specified by a property tag.

    -
    +
    -
    -template<typename T, typename Tag = null_tag>
    +
    template<typename T, typename Tag = null_tag>
     struct is_member_pointer;
     

    Header

    -
    -#include <boost/function_types/is_member_pointer.hpp>
    +
    #include <boost/function_types/is_member_pointer.hpp>
     

    T

    - Type to analyze -

    + Type to analyze +

    Tag

    - Further properties required for a positive result -

    + Further properties required for a positive result +

    is_member_pointer<T,Tag>

    - Predicate value MPL - - Integral - Constant -

    + Predicate value MPL + - Integral + Constant +

    is_member_pointer<T,Tag>::value

    - Constant boolean value -

    + Constant boolean value +

    @@ -217,80 +209,76 @@ type, possibly with additional properties as specified by a property tag.

    -
    +
    -
    -template<typename T>
    +
    template<typename T>
     struct is_member_object_pointer;
     

    Header

    -
    -#include <boost/function_types/is_member_object_pointer.hpp>
    +
    #include <boost/function_types/is_member_object_pointer.hpp>
     

    T

    - Type to analyze -

    + Type to analyze +

    is_member_object_pointer<T>

    - Predicate value MPL - - Integral - Constant -

    + Predicate value MPL + - Integral + Constant +

    is_member_object_pointer<T>::value

    - Constant boolean value -

    + Constant boolean value +

    Determines whether a given type is a pointer to member object type.

    -
    +
    -
    -template<typename T, typename Tag = null_tag>
    +
    template<typename T, typename Tag = null_tag>
     struct is_member_function_pointer;
     

    Header

    -
    -#include <boost/function_types/is_member_function_pointer.hpp>
    +
    #include <boost/function_types/is_member_function_pointer.hpp>
     

    T

    - Type to analyze -

    + Type to analyze +

    Tag

    - Further properties required for a positive result -

    + Further properties required for a positive result +

    is_member_function_pointer<T,Tag>

    - Predicate value MPL - - Integral - Constant -

    + Predicate value MPL + - Integral + Constant +

    is_member_function_pointer<T,Tag>::value

    - Constant boolean value -

    + Constant boolean value +

    @@ -298,42 +286,40 @@ with additional properties as specified by a property tag.

    -
    +
    -
    -template<typename T, typename Tag = null_tag>
    +
    template<typename T, typename Tag = null_tag>
     struct is_callable_builtin;
     

    Header

    -
    -#include <boost/function_types/is_callable_builtin.hpp>
    +
    #include <boost/function_types/is_callable_builtin.hpp>
     

    T

    - Type to analyze -

    + Type to analyze +

    Tag

    - Further properties required for a positive result -

    + Further properties required for a positive result +

    is_callable_builtin<T,Tag>

    - Predicate value as MPL - - Integral - Constant -

    + Predicate value as MPL + - Integral + Constant +

    is_callable_builtin<T,Tag>::value

    - Constant boolean value -

    + Constant boolean value +

    @@ -341,42 +327,40 @@ properties as specified by a property tag.

    -
    +
    -
    -template<typename T, typename Tag = null_tag>
    +
    template<typename T, typename Tag = null_tag>
     struct is_nonmember_callable_builtin;
     

    Header

    -
    -#include <boost/function_types/is_nonmember_callable_builtin.hpp>
    +
    #include <boost/function_types/is_nonmember_callable_builtin.hpp>
     

    T

    - Type to analyze -

    + Type to analyze +

    Tag

    - Further properties required for a positive result -

    + Further properties required for a positive result +

    is_nonmember_callable_builtin<T,Tag>

    - Predicate value as MPL - - Integral - Constant -

    + Predicate value as MPL + - Integral + Constant +

    is_nonmember_callable_builtin<T,Tag>::value

    - Constant boolean value -

    + Constant boolean value +

    @@ -388,7 +372,7 @@

    -

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/boost_functiontypes/reference/decomposition.html b/doc/html/boost_functiontypes/reference/decomposition.html index b4447e4..be8dc6b 100644 --- a/doc/html/boost_functiontypes/reference/decomposition.html +++ b/doc/html/boost_functiontypes/reference/decomposition.html @@ -1,10 +1,10 @@ - + Class templates for type decomposition - - - + + + @@ -13,16 +13,16 @@ - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    -
    +
    -
    -template<typename F>
    +
    template<typename F>
     struct result_type;
     

    Header

    -
    -#include <boost/function_types/result_type.hpp>
    +
    #include <boost/function_types/result_type.hpp>
     

    F

    - Type to analyze -

    + Type to analyze +

    result_type<F>::type

    - Result type of F -

    + Result type of F +

    @@ -73,42 +71,40 @@ the type member results in a compile error.

    -
    +
    -
    -template<typename F, class ClassTransform = add_reference<_> >
    +
    template<typename F, class ClassTransform = add_reference<_> >
     struct parameter_types;
     

    Header

    -
    -#include <boost/function_types/parameter_types.hpp>
    +
    #include <boost/function_types/parameter_types.hpp>
     

    F

    - Type to analyze -

    + Type to analyze +

    ClassTransform

    - MPL - Lambda - Expression to transform the class type if F - is a member function pointer -

    + MPL - Lambda + Expression to transform the class type if F + is a member function pointer +

    parameter_types<F,ClassTransform>

    - MPL - Front - / Back - Extensible - Random - Access Sequence of parameter types -

    + MPL - Front + / Back + Extensible + Random + Access Sequence of parameter types +

    @@ -119,38 +115,36 @@ the sequence results in a compile error.

    -
    +
    -
    -template<typename F>
    +
    template<typename F>
     struct function_arity;
     

    Header

    -
    -#include <boost/function_types/function_arity.hpp>
    +
    #include <boost/function_types/function_arity.hpp>
     

    F

    - Callable builtin type -

    + Callable builtin type +

    function_arity<F>

    - Function arity as MPL - - Integral - Constant -

    + Function arity as MPL + - Integral + Constant +

    function_arity<F>::value

    - Constant value of the function arity -

    + Constant value of the function arity +

    @@ -164,46 +158,44 @@ the value results in a compile error.

    -
    +
    -
    -template<typename T, class ClassTransform = add_reference<_> >
    +
    template<typename T, class ClassTransform = add_reference<_> >
     struct components;
     

    Header

    -
    -#include <boost/function_types/components.hpp>
    +
    #include <boost/function_types/components.hpp>
     

    T

    - Type to analyze -

    + Type to analyze +

    ClassTransform

    - MPL - Lambda - Expression to transform the class type if T - is a member function pointer -

    + MPL - Lambda + Expression to transform the class type if T + is a member function pointer +

    components<T,ClassTransform>

    - MPL - Front - / Back - Extensible - Random - Access Sequence of all component types and property tag -

    + MPL - Front + / Back + Extensible + Random + Access Sequence of all component types and property tag +

    components<T,ClassTransform>::types

    - Decorated MPL Sequence, exposed for optimization -

    + Decorated MPL Sequence, exposed for optimization +

    @@ -219,7 +211,7 @@

    -

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/boost_functiontypes/reference/macros.html b/doc/html/boost_functiontypes/reference/macros.html index ea3f1eb..a482bf0 100644 --- a/doc/html/boost_functiontypes/reference/macros.html +++ b/doc/html/boost_functiontypes/reference/macros.html @@ -1,10 +1,10 @@ - + Macros - - - + + + @@ -13,16 +13,16 @@ - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    + -
    +

    BOOST_FT_MAX_ARITY @@ -65,7 +65,7 @@ to configure the library to work with a compiler and/or calling convention not covered by the auto-detection mechanism in boost/function_types/config/compiler.hpp.

    -
    +

    BOOST_FT_CC_NAMES @@ -90,8 +90,7 @@ The following names are predefined by the library and must not occur in the definition of BOOST_FT_CC_NAMES:

    -
    -#define BOOST_FT_BUILTIN_CC_NAMES \
    +
    #define BOOST_FT_BUILTIN_CC_NAMES \
       (( IMPLICIT           , implicit_cc , BOOST_PP_EMPTY                ))\
       (( CDECL              , cdecl_cc    , BOOST_PP_IDENTITY(__cdecl   ) ))\
       (( STDCALL            , stdcall_cc  , BOOST_PP_IDENTITY(__stdcall ) ))\
    @@ -104,7 +103,7 @@
     // explicitly prior to MSVC 8).
     

    -
    +

    BOOST_FT_CC_* @@ -118,34 +117,33 @@ The macro expands to a list of restrictions, separated by the | character. Possible items are:

    -
      -
    • - callable_builtin -
    • -
    • - member -
    • -
    • - non_member -
    • -
    • - variadic -
    • -
    • - non_variadic -
    • +
        +
      • + callable_builtin +
      • +
      • + member +
      • +
      • + non_member +
      • +
      • + variadic +
      • +
      • + non_variadic +

      If no such macro is defined for a particular calling convention, it is disabled. Example:

      -
      -#define BOOST_FT_CC_STDCALL non_variadic|callable_builtin
      +
      #define BOOST_FT_CC_STDCALL non_variadic|callable_builtin
       // enables stdcall calling convention for all non-variadic, 
       // callable, builtin types
       
    -
    +

    BOOST_FT_COMMON_X86_CCs @@ -154,13 +152,12 @@ Defining this macro causes the following macros to be defined, if not defined already:

    -
    -#define BOOST_FT_CC_CDECL BOOST_FT_COMMON_X86_CCs
    +
    #define BOOST_FT_CC_CDECL BOOST_FT_COMMON_X86_CCs
     #define BOOST_FT_CC_STDCALL non_variadic|BOOST_FT_COMMON_X86_CCs
     #define BOOST_FT_CC_FASTCALL non_variadic|BOOST_FT_COMMON_X86_CCs
     

    -
    +

    BOOST_FT_SYNTAX @@ -173,12 +170,11 @@

    The default definition is as follows:

    -
    -#define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \
    +
    #define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \
               result() lparen() cc_spec() type_mod() name() rparen()
     

    -
    +

    BOOST_FT_NULLARY_PARAM @@ -188,7 +184,7 @@ parameter for nullary function types, empty by default.

    -
    +

    BOOST_FT_NO_CV_FUNC_SUPPORT @@ -205,7 +201,7 @@ The following macros are useful for testing when changing the source code of the library.

    -
    +

    BOOST_FT_PREPROCESSING_MODE @@ -215,7 +211,7 @@ than loading already-preprocessed header files) if defined.

    -
    +

    BOOST_FT_CC_PREPROCESSING @@ -233,7 +229,7 @@

    -

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/boost_functiontypes/reference/synthesis.html b/doc/html/boost_functiontypes/reference/synthesis.html index fdf12ab..fcb4835 100644 --- a/doc/html/boost_functiontypes/reference/synthesis.html +++ b/doc/html/boost_functiontypes/reference/synthesis.html @@ -1,10 +1,10 @@ - + Class templates for type synthesis - - - + + + @@ -13,16 +13,16 @@ - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    -
    +
    -
    -template<typename Types, typename Tag = null_tag> 
    +
    template<typename Types, typename Tag = null_tag> 
     struct function_type;
     

    Header

    -
    -#include <boost/function_types/function_type.hpp>
    +
    #include <boost/function_types/function_type.hpp>
     

    Types

    - Component types in form of an MPL - - Forward - Sequence or another callable, builtin type -

    + Component types in form of an MPL + - Forward + Sequence or another callable, builtin type +

    Tag

    - Further properties -

    + Further properties +

    function_type<Types,Tag>::type

    - Synthesized type -

    + Synthesized type +

    @@ -79,38 +77,36 @@ access the type member will result in a compile error.

    -
    +
    -
    -template<typename Types, typename Tag = null_tag> 
    +
    template<typename Types, typename Tag = null_tag> 
     struct function_pointer;
     

    Header

    -
    -#include <boost/function_types/function_pointer.hpp>
    +
    #include <boost/function_types/function_pointer.hpp>
     

    Types

    - Component types in form of an MPL - - Forward - Sequence or another callable, builtin type -

    + Component types in form of an MPL + - Forward + Sequence or another callable, builtin type +

    Tag

    - Further properties -

    + Further properties +

    function_pointer<Types,Tag>::type

    - Synthesized type -

    + Synthesized type +

    @@ -121,38 +117,36 @@ access the type member will result in a compile error.

    -
    +
    -
    -template<typename Types, typename Tag = null_tag> 
    +
    template<typename Types, typename Tag = null_tag> 
     struct function_reference;
     

    Header

    -
    -#include <boost/function_types/function_reference.hpp>
    +
    #include <boost/function_types/function_reference.hpp>
     

    Types

    - Component types in form of an MPL - - Forward - Sequence or another callable, builtin type -

    + Component types in form of an MPL + - Forward + Sequence or another callable, builtin type +

    Tag

    - Further properties -

    + Further properties +

    function_reference<Types,Tag>::type

    - Synthesized type -

    + Synthesized type +

    @@ -163,38 +157,36 @@ access the type member will result in a compile error.

    -
    +
    -
    -template<typename Types, typename Tag = null_tag> 
    +
    template<typename Types, typename Tag = null_tag> 
     struct member_function_pointer;
     

    Header

    -
    -#include <boost/function_types/member_function_pointer.hpp>
    +
    #include <boost/function_types/member_function_pointer.hpp>
     

    Types

    - Component types in form of an MPL - - Forward - Sequence or another callable, builtin type -

    + Component types in form of an MPL + - Forward + Sequence or another callable, builtin type +

    Tag

    - Further properties -

    + Further properties +

    member_function_pointer<Types,Tag>::type

    - Synthesized type -

    + Synthesized type +

    @@ -214,7 +206,7 @@

    -

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/boost_functiontypes/reference/tag_types.html b/doc/html/boost_functiontypes/reference/tag_types.html index 847d74f..8f4eac2 100644 --- a/doc/html/boost_functiontypes/reference/tag_types.html +++ b/doc/html/boost_functiontypes/reference/tag_types.html @@ -1,10 +1,10 @@ - + Tag Types - - - + + + @@ -13,16 +13,16 @@ - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -52,145 +52,129 @@ null_tag
    tag
    -
    +
    -
    -typedef unspecified variadic;
    +
    typedef unspecified variadic;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type takes a variable number of arguments through an ellipsis parameter (such as printf).

    -
    +
    -
    -typedef unspecified non_variadic;
    +
    typedef unspecified non_variadic;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type does not have an ellipsis parameter.

    -
    +
    -
    -typedef unspecified default_cc;
    +
    typedef unspecified default_cc;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type encodes the default calling convention.

    -
    +
    -
    -typedef unspecified const_qualified;
    +
    typedef unspecified const_qualified;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type is const qualified.

    -
    +
    -
    -typedef unspecified non_const;
    +
    typedef unspecified non_const;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type is not const qualified.

    -
    +
    -
    -typedef unspecified volatile_qualified;
    +
    typedef unspecified volatile_qualified;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type is volatile qualified.

    -
    +
    -
    -typedef unspecified non_volatile;
    +
    typedef unspecified non_volatile;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type is not volatile qualified.

    -
    +
    -
    -typedef unspecified non_cv;
    +
    typedef unspecified non_cv;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type is neither const nor volatile qualified. Equivalent @@ -198,19 +182,17 @@ but involves fewer template instantiations when evaluated.

    -
    +
    -
    -typedef unspecified const_non_volatile;
    +
    typedef unspecified const_non_volatile;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type is const but not volatile qualified. Equivalent @@ -218,19 +200,17 @@ but involves fewer template instantiations when evaluated.

    -
    +
    -
    -typedef unspecified volatile_non_const;
    +
    typedef unspecified volatile_non_const;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type is volatile but not const qualified. Equivalent @@ -238,19 +218,17 @@ but involves fewer template instantiations when evaluated.

    -
    +
    -
    -typedef unspecified cv_qualified;
    +
    typedef unspecified cv_qualified;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States that a function type is both const and volatile qualified. Equivalent @@ -258,50 +236,46 @@ but involves fewer template instantiations when evaluated.

    -
    +
    -
    -typedef unspecified null_tag;
    +
    typedef unspecified null_tag;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    States nothing.

    -
    +
    -
    -template<class Tag1, class Tag2, 
    +
    template<class Tag1, class Tag2, 
         class Tag3 = null_tag, class Tag4 = null_tag>
     struct tag;
     

    Header

    -
    -#include <boost/function_types/property_tags.hpp>
    +
    #include <boost/function_types/property_tags.hpp>
     

    TagN

    - Property tag -

    + Property tag +

    tag<Tag1,Tag2...>

    - Compound property tag -

    + Compound property tag +

    @@ -312,7 +286,7 @@

    -

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/boost_functiontypes/use_cases.html b/doc/html/boost_functiontypes/use_cases.html index 8cee449..cb08d42 100644 --- a/doc/html/boost_functiontypes/use_cases.html +++ b/doc/html/boost_functiontypes/use_cases.html @@ -1,11 +1,11 @@ - + Use Cases - - - - + + + + @@ -13,16 +13,16 @@ - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -36,8 +36,7 @@ a calling convention with each function's type to allow calls across language or (sub-)system boundaries.

    -
    -template<typename R>
    +
    template<typename R>
     void accept_function(R(* func)());
     
     template<typename R>
    @@ -90,8 +89,7 @@
           Using Boost.FunctionTypes it is possible to write a single function template
           instead:
         

    -
    -template<typename F>
    +
    template<typename F>
     void accept_function(F f)
     {
       // ... use Boost.FunctionTypes to analyse F
    @@ -110,8 +108,7 @@
           in. The code below shows three examples for choosing the float(float)
           overload of std::abs.
         

    -
    -float (*ptr_absf)(float) = & std::abs;
    +
    float (*ptr_absf)(float) = & std::abs;
     
     
     void foo(float(*func)(float));
    @@ -129,8 +126,7 @@
           selection and instantiation of function templates. Given an overloaded function
           template
         

    -
    -template<typename R, typename T0>
    +
    template<typename R, typename T0>
     R overloaded(T0);
     
     template<typename R, typename T0, typename T1>
    @@ -143,8 +139,7 @@
           we can pick any of the three overloads and instantiate the template with template
           arguments from a type sequence in a single expression:
         

    -
    -static_cast<function_pointer<Seq>::type>(& overloaded)
    +
    static_cast<function_pointer<Seq>::type>(& overloaded)
     

    This technique can be occasionally more flexible than template argument deduction @@ -165,7 +160,7 @@

    -

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/index.html b/doc/html/index.html index c95f3f7..d64a89b 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -1,33 +1,33 @@ - -Chapter 1. Boost.FunctionTypes 2.5 - - - + +Chapter 1. Boost.FunctionTypes 2.5 + + + - - - + + +
    Boost C++ Libraries HomeLibrariesPeopleFAQLibrariesPeopleFAQ More

    -
    Next
    -
    +
    Next
    +

    -Chapter 1. Boost.FunctionTypes 2.5

    +Chapter 1. Boost.FunctionTypes 2.5

    Tobias Schwinger

    -
    +
    -

    +

    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)

    @@ -46,10 +46,10 @@
    - +

    Last revised: March 14, 2008 at 18:36:46 +0000

    Last revised: , at


    -
    Next
    +
    Next
    From 1f2bc4d8d321c7fc3e2c02236cb5f0917ab49f4a Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 2 Apr 2011 17:20:34 +0000 Subject: [PATCH 13/15] Function types: Merge from trunk. - [49980] adds tests with const result - [53619] Cleanup function_types Jamfile. Fixes #1653 (maybe). - [62827] Update Borland workarounds. Fixes #3162. - [70856] Rebuild documentation [SVN r70861] --- build/Jamfile | 28 +++---- .../boost_functiontypes/about_tag_types.html | 7 +- .../boost_functiontypes/acknowledgements.html | 7 +- .../boost_functiontypes/introduction.html | 7 +- doc/html/boost_functiontypes/rationale.html | 23 +++--- doc/html/boost_functiontypes/reference.html | 19 ++--- .../reference/classification.html | 57 +++++-------- .../reference/decomposition.html | 31 +++---- .../boost_functiontypes/reference/macros.html | 61 +++++--------- .../reference/synthesis.html | 31 +++---- .../reference/tag_types.html | 81 +++++++------------ doc/html/boost_functiontypes/use_cases.html | 7 +- doc/html/index.html | 21 ++--- include/boost/function_types/components.hpp | 8 +- test/decomposition/result_type.cpp | 47 +++++++++-- 15 files changed, 202 insertions(+), 233 deletions(-) diff --git a/build/Jamfile b/build/Jamfile index bace553..38b185a 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -6,31 +6,25 @@ # Generates preprocessed files with wave. -rule wave -{ - Depends $1 : $2 ; -} - actions wave { - ../../../dist/bin/wave -S../../.. $(>) -o $(<) + $(>[1]) -S../../.. $(>[2]) -o $(<) } -make ../../../libs/function_types/build/timestamps/arity_loops - : preprocess_arity_loops.cpp : wave +W = ../../../tools/wave/build//wave ; + +make arity_loops + : preprocess_arity_loops.cpp $(W) : wave : build/timestamps ; -explicit ../../../libs/function_types/build/timestamps/arity_loops ; - -make ../../../libs/function_types/build/timestamps/encoding - : preprocess_encoding.cpp : wave +make encoding + : preprocess_encoding.cpp $(W) : wave : build/timestamps ; -explicit ../../../libs/function_types/build/timestamps/encoding ; -make ../../../libs/function_types/build/timestamps/cc_names - : preprocess_cc_names.cpp : wave +make cc_names + : preprocess_cc_names.cpp $(W) : wave : build/timestamps ; - -explicit ../../../libs/function_types/build/timestamps/cc_names ; + +explicit arity_loops encoding cc_names ; diff --git a/doc/html/boost_functiontypes/about_tag_types.html b/doc/html/boost_functiontypes/about_tag_types.html index 7b9e5ec..9000b58 100644 --- a/doc/html/boost_functiontypes/about_tag_types.html +++ b/doc/html/boost_functiontypes/about_tag_types.html @@ -3,7 +3,7 @@ About Tag Types - + @@ -24,7 +24,7 @@

    Boost.FunctionTypes uses tag types to encode properties that are not types @@ -80,7 +80,8 @@

    -

    Thanks go to the following people for supporting the development of this library @@ -79,7 +79,8 @@

    -

    Boost.FunctionTypes provides functionality to classify, decompose and synthesize @@ -77,7 +77,8 @@

    -

    - + Error handling rationale

    @@ -42,7 +42,7 @@ can be spotted easily.

    - + Why MPL Sequences?

    @@ -55,7 +55,7 @@ so another reason is interoperability.

    - + Pointer to member object types

    @@ -64,7 +64,7 @@ functionals.

    - + The ClassTransform template parameter

    @@ -81,7 +81,7 @@ all parameters uniformly.

    - + Why tag types?

    @@ -100,7 +100,7 @@ with older compilers.

    - + Is it safe to have the synthesis templates take a callable builtin type or an MPL sequence as the first template argument? @@ -115,7 +115,7 @@ type a sequence have been included, which can easily violate the ODR.

    - + Why does the hidden this parameter count for the function arity of member functions? @@ -126,7 +126,7 @@
    mpl::size< parameter_types<T> >::value == function_arity<T>::value
     

    - + Why ignore top-level cv-qualifiers on pointers?

    @@ -137,7 +137,8 @@
    -
    -
    template<typename T, typename Tag = null_tag>
     struct is_function;
    @@ -88,8 +79,7 @@
     
    template<typename T, typename Tag = null_tag>
     struct is_function_pointer;
    @@ -129,8 +119,7 @@
     
    template<typename T, typename Tag = null_tag>
     struct is_function_reference;
    @@ -170,8 +159,7 @@
     
    template<typename T, typename Tag = null_tag>
     struct is_member_pointer;
    @@ -211,8 +199,7 @@
     
    template<typename T>
     struct is_member_object_pointer;
    @@ -247,8 +234,7 @@
     
    template<typename T, typename Tag = null_tag>
     struct is_member_function_pointer;
    @@ -288,8 +274,7 @@
     
    template<typename T, typename Tag = null_tag>
     struct is_callable_builtin;
    @@ -329,8 +314,7 @@
     
    template<typename T, typename Tag = null_tag>
     struct is_nonmember_callable_builtin;
    @@ -372,7 +356,8 @@
     
    -
    template<typename F>
     struct result_type;
    @@ -73,8 +68,7 @@
     
    template<typename F, class ClassTransform = add_reference<_> >
     struct parameter_types;
    @@ -117,8 +111,7 @@
     
    template<typename F>
     struct function_arity;
    @@ -160,8 +153,7 @@
     
    template<typename T, class ClassTransform = add_reference<_> >
     struct components;
    @@ -211,7 +203,8 @@
     
    -

    Expands to a numeric value that describes the maximum function arity supported @@ -67,8 +57,7 @@

    Expands to a sequence @@ -105,8 +94,7 @@

    Enables a specific calling convention. * denotes the macro suffix, as defined @@ -145,8 +133,7 @@

    Defining this macro causes the following macros to be defined, if not defined @@ -159,8 +146,7 @@

    This macro allows to change the syntax of callable builtin types. It is @@ -176,8 +162,7 @@

    Set to void for compilers that insist on a void @@ -186,8 +171,7 @@

    Disables support for cv-qualified function types. Cv-qualified function @@ -203,8 +187,7 @@

    Makes the compiler preprocess as much as possible of the library code (rather @@ -213,8 +196,7 @@

    Makes the compiler preprocess the loop over possible names for custom calling @@ -229,7 +211,8 @@

    -
    template<typename Types, typename Tag = null_tag> 
     struct function_type;
    @@ -79,8 +74,7 @@
     
    template<typename Types, typename Tag = null_tag> 
     struct function_pointer;
    @@ -119,8 +113,7 @@
     
    template<typename Types, typename Tag = null_tag> 
     struct function_reference;
    @@ -159,8 +152,7 @@
     
    template<typename Types, typename Tag = null_tag> 
     struct member_function_pointer;
    @@ -206,7 +198,8 @@
     
    -
    typedef unspecified variadic;
     
    @@ -71,8 +59,7 @@
    typedef unspecified non_variadic;
     
    @@ -87,8 +74,7 @@
    typedef unspecified default_cc;
     
    @@ -103,8 +89,7 @@
    typedef unspecified const_qualified;
     
    @@ -119,8 +104,7 @@
    typedef unspecified non_const;
     
    @@ -135,8 +119,7 @@
    typedef unspecified volatile_qualified;
     
    @@ -151,8 +134,7 @@
    typedef unspecified non_volatile;
     
    @@ -167,7 +149,7 @@
    typedef unspecified non_cv;
     
    @@ -184,8 +166,7 @@
    typedef unspecified const_non_volatile;
     
    @@ -202,8 +183,7 @@
    typedef unspecified volatile_non_const;
     
    @@ -220,8 +200,7 @@
    typedef unspecified cv_qualified;
     
    @@ -238,8 +217,7 @@
    typedef unspecified null_tag;
     
    @@ -254,7 +232,7 @@

    - tag +tag

    template<class Tag1, class Tag2, 
         class Tag3 = null_tag, class Tag4 = null_tag>
    @@ -286,7 +264,8 @@
     
    -

    Generic libraries that accept callable arguments are common in C++. Accepting @@ -160,7 +160,8 @@

    -