diff --git a/include/boost/typeof/compliant/integral_template_param.hpp b/include/boost/typeof/compliant/integral_template_param.hpp deleted file mode 100755 index f1dd477..0000000 --- a/include/boost/typeof/compliant/integral_template_param.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2005 Arkadiy Vertleyb -// Copyright (C) 2005 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_COMPLIANT_INTEGRAL_TEMPLATE_PARAM_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_INTEGRAL_TEMPLATE_PARAM_HPP_INCLUDED - -#include - -// INTEGRAL_PARAM "virtual functions" implementation - -#define BOOST_TYPEOF_INTEGRAL_PARAM_ENCODE(This, n)\ - typedef typename encode_integral<\ - BOOST_PP_CAT(V, n),\ - BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(This),\ - BOOST_PP_CAT(P, n)\ - >::type BOOST_PP_CAT(V, BOOST_PP_INC(n)); - -#define BOOST_TYPEOF_INTEGRAL_PARAM_DECODE(This, n)\ - typedef decode_integral BOOST_PP_CAT(d, n);\ - static const BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(This) BOOST_PP_CAT(P, n) = BOOST_PP_CAT(d, n)::value;\ - typedef typename BOOST_PP_CAT(d, n)::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n)); - -#define BOOST_TYPEOF_INTEGRAL_PARAM_PLACEHOLDER(Param)\ - (BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(Param))0 - -#define BOOST_TYPEOF_INTEGRAL_PARAM_DECLARATION_TYPE(Param)\ - BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(Param) - -#define BOOST_TYPEOF_INTEGRAL_PARAM_PLACEHOLDER_TYPES(Param, n)\ - BOOST_PP_CAT(T,n) - -#define BOOST_TYPEOF_INTEGRAL_PARAM_ISTEMPLATE 0 - - -#endif//BOOST_TYPEOF_COMPLIANT_INTEGRAL_TEMPLATE_PARAM_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/lvalue_typeof.hpp b/include/boost/typeof/compliant/lvalue_typeof.hpp deleted file mode 100755 index 1635bc8..0000000 --- a/include/boost/typeof/compliant/lvalue_typeof.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2004 Arkadiy Vertleyb -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_COMPLIANT_LVALUE_TYPEOF_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_LVALUE_TYPEOF_HPP_INCLUDED - -#include - -namespace boost -{ - namespace type_of - { - enum - { - RVALUE = 1, - LVALUE, - CONST_LVALUE - }; - - char(&classify_expression(...))[ - RVALUE - ]; - - template - char(&classify_expression(T&))[ - is_const::value ? CONST_LVALUE : LVALUE - ]; - - template struct decorate_type - { - typedef T type; - }; - template struct decorate_type - { - typedef T& type; - }; - template struct decorate_type - { - typedef const T& type; - }; - } -} - -// Since this is always a type, -// just add "typename" when using in templates - -#define BOOST_LVALUE_TYPEOF(expr) \ - boost::type_of::decorate_type< \ - BOOST_TYPEOF(expr), \ - sizeof(boost::type_of::classify_expression(expr)) \ - >::type - -#endif//BOOST_TYPEOF_COMPLIANT_LVALUE_TYPEOF_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/template_encoding.hpp b/include/boost/typeof/compliant/template_encoding.hpp deleted file mode 100755 index d1682bf..0000000 --- a/include/boost/typeof/compliant/template_encoding.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2004 Arkadiy Vertleyb -// Copyright (C) 2005 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_COMPLIANT_TEMPLATE_ENCODING_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_TEMPLATE_ENCODING_HPP_INCLUDED - -#include -#include - -#include - -#include -#include -#include - -#include - -#define BOOST_TYPEOF_PLACEHOLDER(z, n, elem)\ - BOOST_TYPEOF_VIRTUAL(PLACEHOLDER, elem)(elem) - -#define BOOST_TYPEOF_PLACEHOLDER_TYPES(z, n, elem)\ - BOOST_TYPEOF_VIRTUAL(PLACEHOLDER_TYPES, elem)(elem, n) - -#define BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM(r, data, n, elem)\ - BOOST_TYPEOF_VIRTUAL(ENCODE, elem)(elem, n) - -#define BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM(r, data, n, elem)\ - BOOST_TYPEOF_VIRTUAL(DECODE, elem)(elem, n) - -#define BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_PAIR(z, n, elem) \ - BOOST_TYPEOF_VIRTUAL(EXPANDTYPE, elem)(elem) BOOST_PP_CAT(P, n) - -#define BOOST_TYPEOF_REGISTER_DEFAULT_TEMPLATE_TYPE(Name,Params,ID)\ - Name< BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params), P) > - -//Since we are creating an internal decode struct, we need to use different template names, T instead of P. -#define BOOST_TYPEOF_REGISTER_DECODER_TYPE_PARAM_PAIR(z,n,elem) \ - BOOST_TYPEOF_VIRTUAL(EXPANDTYPE, elem)(elem) BOOST_PP_CAT(T, n) - -//Default template param decoding -#define BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TYPE(Name,Params)\ - typedef Name type; - -//Branch the decoding -#define BOOST_TYPEOF_TYPEDEF_DECODED_TYPE(Name,Params)\ - BOOST_PP_IF(BOOST_TYPEOF_HAS_TEMPLATES(Params),\ - BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TEMPLATE_TYPE,\ - BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TYPE)(Name,Params) - -#define BOOST_TYPEOF_REGISTER_TEMPLATE_IMPL(Name, Params, Size, ID)\ - namespace boost{namespace type_of{namespace{\ - BOOST_TYPEOF_REGISTER_TEMPLATE_TEMPLATE_IMPL(Name, Params, ID)\ - template\ - struct encode_type_impl >\ - {\ - typedef typename mpl::push_back >::type V0;\ - BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM, ~, Params)\ - typedef BOOST_PP_CAT(V, Size) type;\ - };\ - template\ - struct decode_type_impl, Iter>\ - {\ - typedef Iter iter0;\ - BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM, ~, Params)\ - BOOST_TYPEOF_TYPEDEF_DECODED_TYPE(Name, Params)\ - typedef BOOST_PP_CAT(iter, Size) iter;\ - };\ - }}} - -#endif//BOOST_TYPEOF_COMPLIANT_TEMPLATE_ENCODING_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/type_template_param.hpp b/include/boost/typeof/compliant/type_template_param.hpp deleted file mode 100755 index 559236b..0000000 --- a/include/boost/typeof/compliant/type_template_param.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2005 Arkadiy Vertleyb -// Copyright (C) 2005 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_COMPLIANT_TYPE_TEMPLATE_PARAM_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_TYPE_TEMPLATE_PARAM_HPP_INCLUDED - -#include - -// TYPE_PARAM "virtual functions" implementation - -#define BOOST_TYPEOF_TYPE_PARAM_ENCODE(This, n)\ - typedef typename encode_type<\ - BOOST_PP_CAT(V, n),\ - BOOST_PP_CAT(P, n)\ - >::type BOOST_PP_CAT(V, BOOST_PP_INC(n)); - -#define BOOST_TYPEOF_TYPE_PARAM_DECODE(This, n)\ - typedef decode_type< BOOST_PP_CAT(iter, n) > BOOST_PP_CAT(d, n);\ - typedef typename BOOST_PP_CAT(d, n)::type BOOST_PP_CAT(P, n);\ - typedef typename BOOST_PP_CAT(d, n)::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n)); - -#define BOOST_TYPEOF_TYPE_PARAM_PLACEHOLDER(Param) int -#define BOOST_TYPEOF_TYPE_PARAM_DECLARATION_TYPE(Param) class -#define BOOST_TYPEOF_TYPE_PARAM_PLACEHOLDER_TYPES(Param, n) BOOST_PP_CAT(T,n) -#define BOOST_TYPEOF_TYPE_PARAM_ISTEMPLATE 0 - -#endif//BOOST_TYPEOF_COMPLIANT_TYPE_TEMPLATE_PARAM_HPP_INCLUDED diff --git a/include/boost/typeof/config.hpp b/include/boost/typeof/config.hpp index fa32545..056108b 100755 --- a/include/boost/typeof/config.hpp +++ b/include/boost/typeof/config.hpp @@ -8,9 +8,7 @@ #include #if !defined(BOOST_TYPEOF_COMPLIANT) &&\ - !defined(BOOST_TYPEOF_VINTAGE) &&\ - !defined(BOOST_TYPEOF_NATIVE) &&\ - !defined(BOOST_TYPEOF_MSVC) + !defined(BOOST_TYPEOF_NATIVE) # if defined __GNUC__ # define BOOST_TYPEOF_NATIVE @@ -22,19 +20,11 @@ //Doesn't require registration # define BOOST_TYPEOF_NATIVE -# elif defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# define BOOST_TYPEOF_VINTAGE - -# else +# elif !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # define BOOST_TYPEOF_COMPLIANT # endif #endif -#ifdef BOOST_TYPEOF_VINTAGE -#include -#endif - - #endif//BOOST_TYPEOF_CONFIG_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/encode_decode.hpp b/include/boost/typeof/encode_decode.hpp old mode 100755 new mode 100644 similarity index 100% rename from include/boost/typeof/compliant/encode_decode.hpp rename to include/boost/typeof/encode_decode.hpp diff --git a/include/boost/typeof/compliant/encode_decode_params.hpp b/include/boost/typeof/encode_decode_params.hpp old mode 100755 new mode 100644 similarity index 84% rename from include/boost/typeof/compliant/encode_decode_params.hpp rename to include/boost/typeof/encode_decode_params.hpp index 33f225f..73dc5a7 --- a/include/boost/typeof/compliant/encode_decode_params.hpp +++ b/include/boost/typeof/encode_decode_params.hpp @@ -2,8 +2,8 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_TYPEOF_COMPLIANT_ENCODE_DECODE_PARAMS_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_ENCODE_DECODE_PARAMS_HPP_INCLUDED +#ifndef BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED +#define BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED #include #include @@ -31,4 +31,4 @@ typename mpl::push_back >::type \ BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_END, ~) -#endif//BOOST_TYPEOF_COMPLIANT_ENCODE_DECODE_PARAMS_HPP_INCLUDED +#endif//BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/int_encoding.hpp b/include/boost/typeof/int_encoding.hpp old mode 100755 new mode 100644 similarity index 100% rename from include/boost/typeof/compliant/int_encoding.hpp rename to include/boost/typeof/int_encoding.hpp diff --git a/include/boost/typeof/integral_template_param.hpp b/include/boost/typeof/integral_template_param.hpp index f441171..0a6e503 100755 --- a/include/boost/typeof/integral_template_param.hpp +++ b/include/boost/typeof/integral_template_param.hpp @@ -52,4 +52,29 @@ #define BOOST_TYPEOF_INTEGRAL_PARAM_EXPANDTYPE(Param)\ BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(Param) +// INTEGRAL_PARAM "virtual functions" implementation + +#define BOOST_TYPEOF_INTEGRAL_PARAM_ENCODE(This, n)\ + typedef typename encode_integral<\ + BOOST_PP_CAT(V, n),\ + BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(This),\ + BOOST_PP_CAT(P, n)\ + >::type BOOST_PP_CAT(V, BOOST_PP_INC(n)); + +#define BOOST_TYPEOF_INTEGRAL_PARAM_DECODE(This, n)\ + typedef decode_integral BOOST_PP_CAT(d, n);\ + static const BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(This) BOOST_PP_CAT(P, n) = BOOST_PP_CAT(d, n)::value;\ + typedef typename BOOST_PP_CAT(d, n)::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n)); + +#define BOOST_TYPEOF_INTEGRAL_PARAM_PLACEHOLDER(Param)\ + (BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(Param))0 + +#define BOOST_TYPEOF_INTEGRAL_PARAM_DECLARATION_TYPE(Param)\ + BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(Param) + +#define BOOST_TYPEOF_INTEGRAL_PARAM_PLACEHOLDER_TYPES(Param, n)\ + BOOST_PP_CAT(T,n) + +#define BOOST_TYPEOF_INTEGRAL_PARAM_ISTEMPLATE 0 + #endif//BOOST_TYPEOF_INTEGRAL_TEMPLATE_PARAM_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/limit_size.hpp b/include/boost/typeof/limit_size.hpp old mode 100755 new mode 100644 similarity index 84% rename from include/boost/typeof/compliant/limit_size.hpp rename to include/boost/typeof/limit_size.hpp index 06701c8..43c3c7c --- a/include/boost/typeof/compliant/limit_size.hpp +++ b/include/boost/typeof/limit_size.hpp @@ -2,8 +2,8 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_TYPEOF_COMPLIANT_LIMIT_SIZE_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_LIMIT_SIZE_HPP_INCLUDED +#ifndef BOOST_TYPEOF_LIMIT_SIZE_HPP_INCLUDED +#define BOOST_TYPEOF_LIMIT_SIZE_HPP_INCLUDED #include "boost/mpl/vector.hpp" #include "boost/mpl/aux_/config/ctps.hpp" @@ -32,4 +32,4 @@ namespace boost #endif//BOOST_TYPEOF_LIMIT_SIZE > BOOST_MPL_LIMIT_VECTOR_SIZE -#endif//BOOST_TYPEOF_COMPLIANT_LIMIT_SIZE_HPP_INCLUDED +#endif//BOOST_TYPEOF_LIMIT_SIZE_HPP_INCLUDED diff --git a/include/boost/typeof/vintage/lvalue_typeof.hpp b/include/boost/typeof/lvalue_typeof.hpp similarity index 73% rename from include/boost/typeof/vintage/lvalue_typeof.hpp rename to include/boost/typeof/lvalue_typeof.hpp index 01ad457..d99031b 100644 --- a/include/boost/typeof/vintage/lvalue_typeof.hpp +++ b/include/boost/typeof/lvalue_typeof.hpp @@ -1,9 +1,10 @@ +// Copyright (C) 2004 Arkadiy Vertleyb // Copyright (C) 2004 Peder Holt // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_VINTAGE_LVALUE_TYPEOF_HPP_INCLUDED -#define BOOST_VINTAGE_LVALUE_TYPEOF_HPP_INCLUDED +#ifndef BOOST_TYPEOF_LVALUE_TYPEOF_HPP_INCLUDED +#define BOOST_TYPEOF_LVALUE_TYPEOF_HPP_INCLUDED #include @@ -26,6 +27,20 @@ namespace boost char(*classify_expression(T&))[ is_const::value ? CONST_LVALUE : LVALUE ]; +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + template struct decorate_type + { + typedef T type; + }; + template struct decorate_type + { + typedef T& type; + }; + template struct decorate_type + { + typedef const T& type; + }; +#else template struct decorate_type_impl { template @@ -53,9 +68,11 @@ namespace boost { typedef decorate_type_impl::inner::type type; }; +#endif } } + // Since this is always a type, // just add "typename" when using in templates @@ -66,4 +83,4 @@ namespace boost >::type -#endif //BOOST_VINTAGE_LVALUE_TYPEOF_HPP_INCLUDED \ No newline at end of file +#endif//BOOST_TYPEOF_LVALUE_TYPEOF_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/modifiers.hpp b/include/boost/typeof/modifiers.hpp old mode 100755 new mode 100644 similarity index 92% rename from include/boost/typeof/compliant/modifiers.hpp rename to include/boost/typeof/modifiers.hpp index 5854721..504921f --- a/include/boost/typeof/compliant/modifiers.hpp +++ b/include/boost/typeof/modifiers.hpp @@ -2,10 +2,10 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_TYPEOF_COMPLIANT_MODIFIERS_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_MODIFIERS_HPP_INCLUDED +#ifndef BOOST_TYPEOF_MODIFIERS_HPP_INCLUDED +#define BOOST_TYPEOF_MODIFIERS_HPP_INCLUDED -#include +#include #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() @@ -88,4 +88,4 @@ namespace boost{namespace type_of{namespace{ #undef BOOST_TYPEOF_array_support -#endif//BOOST_TYPEOF_COMPLIANT_MODIFIERS_HPP_INCLUDED +#endif//BOOST_TYPEOF_MODIFIERS_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/pointers_data_members.hpp b/include/boost/typeof/pointers_data_members.hpp old mode 100755 new mode 100644 similarity index 76% rename from include/boost/typeof/compliant/pointers_data_members.hpp rename to include/boost/typeof/pointers_data_members.hpp index 8621633..ca6f349 --- a/include/boost/typeof/compliant/pointers_data_members.hpp +++ b/include/boost/typeof/pointers_data_members.hpp @@ -2,11 +2,11 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_TYPEOF_COMPLIANT_POINTERS_DATA_MEMBERS_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_POINTERS_DATA_MEMBERS_HPP_INCLUDED +#ifndef BOOST_TYPEOF_POINTERS_DATA_MEMBERS_HPP_INCLUDED +#define BOOST_TYPEOF_POINTERS_DATA_MEMBERS_HPP_INCLUDED -#include -#include +#include +#include #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() @@ -41,4 +41,4 @@ namespace boost } } -#endif//BOOST_TYPEOF_COMPLIANT_POINTERS_DATA_MEMBERS_HPP_INCLUDED +#endif//BOOST_TYPEOF_POINTERS_DATA_MEMBERS_HPP_INCLUDED diff --git a/include/boost/typeof/register_functions.hpp b/include/boost/typeof/register_functions.hpp index f462a22..0f749d8 100755 --- a/include/boost/typeof/register_functions.hpp +++ b/include/boost/typeof/register_functions.hpp @@ -37,8 +37,8 @@ namespace boost namespace type_of { # define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPEOF_LIMIT_FUNCTION_ARITY) - // BOOST_PP_FILENAME_1 is defined outside - # include BOOST_PP_ITERATE() + # define BOOST_PP_FILENAME_1 + # include BOOST_PP_ITERATE() } } diff --git a/include/boost/typeof/compliant/register_functions_iterate.hpp b/include/boost/typeof/register_functions_iterate.hpp old mode 100755 new mode 100644 similarity index 88% rename from include/boost/typeof/compliant/register_functions_iterate.hpp rename to include/boost/typeof/register_functions_iterate.hpp index 391c59a..410be18 --- a/include/boost/typeof/compliant/register_functions_iterate.hpp +++ b/include/boost/typeof/register_functions_iterate.hpp @@ -2,7 +2,7 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#include +#include #define n BOOST_PP_ITERATION() @@ -66,19 +66,19 @@ namespace #define BOOST_TYPEOF_qualifier #define BOOST_TYPEOF_id MEM_FUN_ID - #include + #include #define BOOST_TYPEOF_qualifier const #define BOOST_TYPEOF_id CONST_MEM_FUN_ID - #include + #include #define BOOST_TYPEOF_qualifier volatile #define BOOST_TYPEOF_id VOLATILE_MEM_FUN_ID - #include + #include #define BOOST_TYPEOF_qualifier volatile const #define BOOST_TYPEOF_id VOLATILE_CONST_MEM_FUN_ID - #include + #include } #undef n diff --git a/include/boost/typeof/register_fundamental.hpp b/include/boost/typeof/register_fundamental.hpp index e8ab8ad..65f4ab8 100755 --- a/include/boost/typeof/register_fundamental.hpp +++ b/include/boost/typeof/register_fundamental.hpp @@ -1,4 +1,5 @@ // Copyright (C) 2004 Arkadiy Vertleyb +// Copyright (C) 2004 Peder Holt // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/typeof/compliant/register_mem_functions.hpp b/include/boost/typeof/register_mem_functions.hpp old mode 100755 new mode 100644 similarity index 94% rename from include/boost/typeof/compliant/register_mem_functions.hpp rename to include/boost/typeof/register_mem_functions.hpp index 86bbfee..0959303 --- a/include/boost/typeof/compliant/register_mem_functions.hpp +++ b/include/boost/typeof/register_mem_functions.hpp @@ -2,7 +2,7 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#include +#include // member functions diff --git a/include/boost/typeof/template_encoding.hpp b/include/boost/typeof/template_encoding.hpp index 90a76c6..ef97d7f 100755 --- a/include/boost/typeof/template_encoding.hpp +++ b/include/boost/typeof/template_encoding.hpp @@ -13,6 +13,16 @@ #include #include #include +#include + +#include +#include + +#include +#include +#include + + // The template parameter description, entered by the user, // is converted into a polymorphic "object" @@ -81,4 +91,58 @@ #define BOOST_TYPEOF_SEQ_ENUM_TRAILING_1(seq,macro)\ BOOST_PP_ENUM_TRAILING(BOOST_PP_SEQ_SIZE(seq),BOOST_TYPEOF_SEQ_EXPAND_ELEMENT_1,(macro)(seq)) +#define BOOST_TYPEOF_PLACEHOLDER(z, n, elem)\ + BOOST_TYPEOF_VIRTUAL(PLACEHOLDER, elem)(elem) + +#define BOOST_TYPEOF_PLACEHOLDER_TYPES(z, n, elem)\ + BOOST_TYPEOF_VIRTUAL(PLACEHOLDER_TYPES, elem)(elem, n) + +#define BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM(r, data, n, elem)\ + BOOST_TYPEOF_VIRTUAL(ENCODE, elem)(elem, n) + +#define BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM(r, data, n, elem)\ + BOOST_TYPEOF_VIRTUAL(DECODE, elem)(elem, n) + +#define BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_PAIR(z, n, elem) \ + BOOST_TYPEOF_VIRTUAL(EXPANDTYPE, elem)(elem) BOOST_PP_CAT(P, n) + +#define BOOST_TYPEOF_REGISTER_DEFAULT_TEMPLATE_TYPE(Name,Params,ID)\ + Name< BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params), P) > + +//Since we are creating an internal decode struct, we need to use different template names, T instead of P. +#define BOOST_TYPEOF_REGISTER_DECODER_TYPE_PARAM_PAIR(z,n,elem) \ + BOOST_TYPEOF_VIRTUAL(EXPANDTYPE, elem)(elem) BOOST_PP_CAT(T, n) + +//Default template param decoding +#define BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TYPE(Name,Params)\ + typedef Name type; + +//Branch the decoding +#define BOOST_TYPEOF_TYPEDEF_DECODED_TYPE(Name,Params)\ + BOOST_PP_IF(BOOST_TYPEOF_HAS_TEMPLATES(Params),\ + BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TEMPLATE_TYPE,\ + BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TYPE)(Name,Params) + +#define BOOST_TYPEOF_REGISTER_TEMPLATE_IMPL(Name, Params, Size, ID)\ + namespace boost{namespace type_of{namespace{\ + BOOST_TYPEOF_REGISTER_TEMPLATE_TEMPLATE_IMPL(Name, Params, ID)\ + template\ + struct encode_type_impl >\ + {\ + typedef typename mpl::push_back >::type V0;\ + BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM, ~, Params)\ + typedef BOOST_PP_CAT(V, Size) type;\ + };\ + template\ + struct decode_type_impl, Iter>\ + {\ + typedef Iter iter0;\ + BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM, ~, Params)\ + BOOST_TYPEOF_TYPEDEF_DECODED_TYPE(Name, Params)\ + typedef BOOST_PP_CAT(iter, Size) iter;\ + };\ + }}} + #endif//BOOST_TYPEOF_TEMPLATE_ENCODING_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/template_template_param.hpp b/include/boost/typeof/template_template_param.hpp similarity index 95% rename from include/boost/typeof/compliant/template_template_param.hpp rename to include/boost/typeof/template_template_param.hpp index 969a505..3d1cba8 100644 --- a/include/boost/typeof/compliant/template_template_param.hpp +++ b/include/boost/typeof/template_template_param.hpp @@ -3,8 +3,8 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_TYPEOF_COMPLIANT_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED +#ifndef BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED +#define BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED #include #include @@ -123,4 +123,4 @@ namespace boost BOOST_TYPEOF_REGISTER_NOTHING,\ BOOST_TYPEOF_REGISTER_TYPE_FOR_TEMPLATE_TEMPLATE)(Name,Params,ID) -#endif //BOOST_TYPEOF_COMPLIANT_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED +#endif //BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/type_encoding.hpp b/include/boost/typeof/type_encoding.hpp old mode 100755 new mode 100644 similarity index 86% rename from include/boost/typeof/compliant/type_encoding.hpp rename to include/boost/typeof/type_encoding.hpp index f9b1d88..cb877f0 --- a/include/boost/typeof/compliant/type_encoding.hpp +++ b/include/boost/typeof/type_encoding.hpp @@ -2,8 +2,8 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_TYPEOF_COMPLIANT_TYPE_ENCODING_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_TYPE_ENCODING_HPP_INCLUDED +#ifndef BOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED +#define BOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED #define BOOST_TYPEOF_REGISTER_TYPE_IMPL(T, Id) \ \ @@ -21,4 +21,4 @@ BOOST_TYPEOF_REGISTER_TYPE_IMPL(Type, BOOST_TYPEOF_UNIQUE_ID()) \ }}} -#endif//BOOST_TYPEOF_COMPLIANT_TYPE_ENCODING_HPP_INCLUDED +#endif//BOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED diff --git a/include/boost/typeof/type_template_param.hpp b/include/boost/typeof/type_template_param.hpp index 76a0d56..34e063c 100755 --- a/include/boost/typeof/type_template_param.hpp +++ b/include/boost/typeof/type_template_param.hpp @@ -16,4 +16,22 @@ #define BOOST_TYPEOF_TYPE_PARAM_EXPANDTYPE(Param) class +// TYPE_PARAM "virtual functions" implementation + +#define BOOST_TYPEOF_TYPE_PARAM_ENCODE(This, n)\ + typedef typename encode_type<\ + BOOST_PP_CAT(V, n),\ + BOOST_PP_CAT(P, n)\ + >::type BOOST_PP_CAT(V, BOOST_PP_INC(n)); + +#define BOOST_TYPEOF_TYPE_PARAM_DECODE(This, n)\ + typedef decode_type< BOOST_PP_CAT(iter, n) > BOOST_PP_CAT(d, n);\ + typedef typename BOOST_PP_CAT(d, n)::type BOOST_PP_CAT(P, n);\ + typedef typename BOOST_PP_CAT(d, n)::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n)); + +#define BOOST_TYPEOF_TYPE_PARAM_PLACEHOLDER(Param) int +#define BOOST_TYPEOF_TYPE_PARAM_DECLARATION_TYPE(Param) class +#define BOOST_TYPEOF_TYPE_PARAM_PLACEHOLDER_TYPES(Param, n) BOOST_PP_CAT(T,n) +#define BOOST_TYPEOF_TYPE_PARAM_ISTEMPLATE 0 + #endif//BOOST_TYPEOF_TYPE_TEMPLATE_PARAM_HPP_INCLUDED diff --git a/include/boost/typeof/typeof.hpp b/include/boost/typeof/typeof.hpp index f068351..7fb4314 100755 --- a/include/boost/typeof/typeof.hpp +++ b/include/boost/typeof/typeof.hpp @@ -23,12 +23,7 @@ #elif defined(BOOST_TYPEOF_COMPLIANT) # define BOOST_TYPEOF_TEXT "using compliant imlementation" # include -# include - -#elif defined(BOOST_TYPEOF_VINTAGE) -# define BOOST_TYPEOF_TEXT "using vintage imlementation" -# include -# include +# include #else//BOOST_TYPEOF_NATIVE @@ -45,21 +40,14 @@ // lvalue typeof -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -# include -#else -# include -#endif +# include // type/template encoding #if defined(BOOST_TYPEOF_COMPLIANT) -# include -# include -#elif defined(BOOST_TYPEOF_VINTAGE) -# include -# include -#else//BOOST_TYPEOF_NATIVE and BOOST_TYPEOF_MSVC +# include +# include +#else //BOOST_TYPEOF_NATIVE # define BOOST_TYPEOF_REGISTER_TYPE(x) # define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params) #endif @@ -75,17 +63,12 @@ #if defined(BOOST_TYPEOF_COMPLIANT) -# include -# include -# define BOOST_PP_FILENAME_1 +# include +# include # include -#elif defined(BOOST_TYPEOF_VINTAGE) -# include -# include -# define BOOST_PP_FILENAME_1 -# include #else //BOOST_TYPEOF_NATIVE + #endif #endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/typeof_impl.hpp b/include/boost/typeof/typeof_impl.hpp old mode 100755 new mode 100644 similarity index 90% rename from include/boost/typeof/compliant/typeof_impl.hpp rename to include/boost/typeof/typeof_impl.hpp index 24808c9..9f880e0 --- a/include/boost/typeof/compliant/typeof_impl.hpp +++ b/include/boost/typeof/typeof_impl.hpp @@ -2,12 +2,12 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_TYPEOF_COMPLIANT_TYPEOF_IMPL_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_TYPEOF_IMPL_HPP_INCLUDED +#ifndef BOOST_TYPEOF_TYPEOF_IMPL_HPP_INCLUDED +#define BOOST_TYPEOF_TYPEOF_IMPL_HPP_INCLUDED #include #include -#include +#include #ifdef BOOST_TYPEOF_USE_MPL_VECTOR # include @@ -15,10 +15,10 @@ # include # include # include -# include +# include # define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::mpl::vector, n) #else -# include +# include # define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::type_of::vector, n) #endif diff --git a/include/boost/typeof/compliant/vector.hpp b/include/boost/typeof/vector.hpp old mode 100755 new mode 100644 similarity index 97% rename from include/boost/typeof/compliant/vector.hpp rename to include/boost/typeof/vector.hpp index 38959a0..fe49a42 --- a/include/boost/typeof/compliant/vector.hpp +++ b/include/boost/typeof/vector.hpp @@ -6,8 +6,8 @@ // Works a little faster with VC7.1 and a lot faster with GCC (compliant mode). // Define BOOST_TYPEOF_USE_MPL_VECTOR to avoid it and use mpl::vector<> instead. -#ifndef BOOST_TYPEOF_COMPLIANT_VECTOR_HPP_INCLUDED -#define BOOST_TYPEOF_COMPLIANT_VECTOR_HPP_INCLUDED +#ifndef BOOST_TYPEOF_VECTOR_HPP_INCLUDED +#define BOOST_TYPEOF_VECTOR_HPP_INCLUDED #include #include diff --git a/include/boost/typeof/vintage/concatenate.hpp b/include/boost/typeof/vintage/concatenate.hpp deleted file mode 100644 index 4d0f2e6..0000000 --- a/include/boost/typeof/vintage/concatenate.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_CONCATENATE_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_CONCATENATE_HPP_INCLUDED - -#include -#include -#include -#include -#include -#include - -#include -// Assumes iter0 contains initial iterator - -#define BOOST_TYPEOF_DECODE_PARAM(z, n, text) \ - typedef decode_impl::decoder decode##n;\ - typedef typename decode##n::type P##n; \ - typedef typename decode##n::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n)); - -#define BOOST_TYPEOF_DECODE_PARAMS(n)\ - BOOST_PP_REPEAT(n, BOOST_TYPEOF_DECODE_PARAM, _); - -#define BOOST_TYPEOF_PUSH_FRONT(z,n,template_size)\ - typedef type_list<\ - BOOST_PP_CAT(P,BOOST_PP_DEC(BOOST_PP_SUB(template_size,n))),\ - BOOST_PP_CAT(types_,BOOST_PP_SUB(template_size,n))\ - > BOOST_PP_CAT(types_,BOOST_PP_DEC(BOOST_PP_SUB(template_size,n))); - -#endif//BOOST_TYPEOF_CONCATENATE_HPP_INCLUDED diff --git a/include/boost/typeof/vintage/config.hpp b/include/boost/typeof/vintage/config.hpp deleted file mode 100644 index f232082..0000000 --- a/include/boost/typeof/vintage/config.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#include -#include - -#ifndef BOOST_TYPEOF_VINTAGE_CONFIG_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_CONFIG_HPP_INCLUDED - -#ifndef BOOST_MAX_TYPEOF_COUNTER -#define BOOST_MAX_TYPEOF_COUNTER 1000 -#endif - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# define BOOST_MIN_TYPEOF_COUNTER 5 -#else -# define BOOST_MIN_TYPEOF_COUNTER 1 -#endif - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -#define TYPEOF_MSVC_ETI_WRAPPER(name) \ -namespace boost { namespace type_of { namespace detail \ -{ \ - template \ - struct BOOST_PP_CAT(get_, name) \ - { \ - typedef typename T::name type; \ - }; \ - \ - template <> \ - struct BOOST_PP_CAT(get_, name) \ - { \ - typedef int type; \ - }; \ -}}} -#endif //BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -TYPEOF_MSVC_ETI_WRAPPER(next) -# define TYPEOF_GET_NEXT(T) ::boost::type_of::detail::get_next::type -#else -# define TYPEOF_GET_NEXT(T) typename T::next -#endif - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) \ - || BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -namespace boost { namespace type_of { namespace detail -{ - template - struct get_value - { - BOOST_STATIC_CONSTANT(int, value = T::value); - }; - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - - // VC6 ETI (early template instantiation) bug workaround. - template <> - struct get_value - { - BOOST_STATIC_CONSTANT(int, value = 0); - }; -#endif -}}} -#endif - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) \ - || BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# define TYPEOF_GET_VALUE(T) ::boost::type_of::detail::get_value::value -#else -# define TYPEOF_GET_VALUE(T) T::value -#endif - -#endif //BOOST_TYPEOF_VINTAGE_CONFIG_HPP_INCLUDED diff --git a/include/boost/typeof/vintage/encode_decode.hpp b/include/boost/typeof/vintage/encode_decode.hpp deleted file mode 100644 index c409213..0000000 --- a/include/boost/typeof/vintage/encode_decode.hpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_ENCODE_DECODE_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_ENCODE_DECODE_HPP_INCLUDED - -#define BOOST_TYPEOF_UNIQUE_ID()\ - BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__ - -#define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\ - - -#include - -namespace boost -{ - namespace type_of - { - template - struct encode_impl { - template - struct encoder { - }; - }; - template - struct decode_impl{ - template - struct decoder { - typedef int type; - typedef int iter; - }; - #if BOOST_WORKAROUND(BOOST_MSVC,<=1300) - template<> - struct decoder { - typedef int type; - typedef int iter; - }; - #endif - }; - - template - struct encode_modifier { - BOOST_STATIC_CONSTANT(unsigned,value=modifier_category::value); - typedef typename encode_impl::template encoder encoded_type; - }; - } -} - -#endif//BOOST_TYPEOF_VINTAGE_ENCODE_DECODE_HPP_INCLUDED diff --git a/include/boost/typeof/vintage/int_encoding.hpp b/include/boost/typeof/vintage/int_encoding.hpp deleted file mode 100644 index 08b3614..0000000 --- a/include/boost/typeof/vintage/int_encoding.hpp +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_INT_ENCODING_HPP_INCLUDED -#define BOOST_TYPEOF_VINTATE_INT_ENCODING_HPP_INCLUDED - -#include - -namespace boost {namespace type_of { - -template -struct integral_wrapper {}; - -template -struct encode_integral { - template - struct encoder { - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(typename encode_modifier::type,typename Types::type,typename Types::next>::encoded_type)); - - friend sizer encode_value(const sizer&,const sizer&); - }; -}; -//Special implementation for 0x80000000 and 0x7FFFFFFF in order to allow representation of all numbers -template<> -struct encode_integral<0x80000000> -{ - template - struct encoder { - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(typename encode_modifier::type>::type,typename Types::type,typename Types::next>::encoded_type)); - - friend sizer<0xFFFFFFFF> encode_value(const sizer&,const sizer&); - friend sizer<0x80000000> encode_value(const sizer&,const sizer<(V::pos)+1>&); - }; -}; - -template<> -struct encode_integral<0x7FFFFFFF> -{ - template - struct encoder { - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(typename encode_modifier::type>::type,typename Types::type,typename Types::next>::encoded_type)); - - friend sizer<0xFFFFFFFF> encode_value(const sizer&,const sizer&); - friend sizer<0x7FFFFFFF> encode_value(const sizer&,const sizer<(V::pos)+1>&); - }; -}; - -template -encode_integral::encoder encode(integral_wrapper const&(*)(V,Types)); - -template -struct decode_integral_base { - template - struct decoder { - BOOST_STATIC_CONSTANT(int,value=N^0x80000000); - typedef Iter iter; - }; -#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) - template<> - struct decoder { - BOOST_STATIC_CONSTANT(unsigned,value=1); - typedef int iter; - }; -#endif -}; - -template<> -struct decode_integral_base<0xFFFFFFFF> { - template - struct decoder { - BOOST_STATIC_CONSTANT(int,value=Iter::value); - typedef typename Iter::next iter; - }; -#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) - template<> - struct decoder { - BOOST_STATIC_CONSTANT(unsigned,value=1); - typedef int iter; - }; -#endif -}; - -template -struct decode_integral : decode_integral_base::decoder -{ -}; - -}}//namespace boost::type_of - -#endif //BOOST_TYPEOF_INTEGRAL_WRAPPER_HPP_HOLT_2004_0818 diff --git a/include/boost/typeof/vintage/is_pointer.hpp b/include/boost/typeof/vintage/is_pointer.hpp deleted file mode 100644 index 33e6bb8..0000000 --- a/include/boost/typeof/vintage/is_pointer.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_IS_POINTER_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_IS_POINTER_HPP_INCLUDED - -#include -#include - -namespace boost { namespace type_of { - template - boost::detail::yes_type is_pointer_tester(T*); - boost::detail::no_type is_pointer_tester(...); - - template - struct is_pointer_select - : ::boost::type_traits::false_result - { - }; - - template <> - struct is_pointer_select - { - template struct result_ - { - static T& make_t(); - BOOST_STATIC_CONSTANT(bool, value = - (1 == sizeof(is_pointer_tester(make_t()))) - ); - }; - }; - - template - struct is_pointer_impl - : is_pointer_select< - ::boost::type_traits::ice_or< - ::boost::is_reference::value - , ::boost::is_array::value - >::value - >::template result_ - { - }; - - template - struct is_pointer : is_pointer_impl - {}; - - template<> - struct is_pointer : ::boost::mpl::false_ - {}; -}}//namespace boost::type_of - -#endif //BOOST_TYPEOF_VINTAGE_IS_POINTER_HPP_INCLUDED diff --git a/include/boost/typeof/vintage/modifier_array.hpp b/include/boost/typeof/vintage/modifier_array.hpp deleted file mode 100644 index c785aee..0000000 --- a/include/boost/typeof/vintage/modifier_array.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -template<> -struct encode_impl -{ - template - struct encoder { - BOOST_STATIC_CONSTANT(unsigned,size=(sizeof(*((T*)NULL))/sizeof((*((T*)NULL))[0]))); - typedef typename mpl::next::type>::type next_type; - typedef void(*function_ptr)( - sizer, - next_type, - T, - Types - ); - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL)))); - - friend sizer encode_value(const sizer&,const sizer&); - friend sizer encode_value(const sizer&,const sizer<(V::pos)+1>&); - }; -}; -template -typename encode_modifier::encoded_type encode(void(*)(sizer,V,T BOOST_TYPEOF_qualifier[],Types)); - -template<> -struct decode_impl -{ - template - struct decoder { - BOOST_STATIC_CONSTANT(unsigned,size=Iter::value); - typedef typename Iter::next iter1; - typedef typename decode_impl::decoder decode1; - typedef typename decode1::type BOOST_TYPEOF_qualifier type[size]; - typedef typename decode1::iter iter; - }; -}; diff --git a/include/boost/typeof/vintage/modifier_category.hpp b/include/boost/typeof/vintage/modifier_category.hpp deleted file mode 100644 index 7c7b4fe..0000000 --- a/include/boost/typeof/vintage/modifier_category.hpp +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_MODIFIER_CATEGORY_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_MODIFIER_CATEGORY_HPP_INCLUDED - -#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { namespace type_of { - enum { - FUNCTION_OR_MEMBER_ID=BOOST_TYPEOF_UNIQUE_ID(), - VOID_ID, - NO_MODIFIERS, - CONST_ID, - VOLATILE_ID, - CV_ID, - POINTER_ID, - CONST_POINTER_ID, - VOLATILE_POINTER_ID, - CV_POINTER_ID, - REFERENCE_ID, - CONST_REFERENCE_ID, - VOLATILE_REFERENCE_ID, - CV_REFERENCE_ID, - ARRAY_ID, - CONST_ARRAY_ID, - VOLATILE_ARRAY_ID, - CV_ARRAY_ID, - MEMBER_POINTER_ID, - }; - -template -struct cv_type { - BOOST_STATIC_CONSTANT(unsigned,value=(N+is_const::value+is_volatile::value*2)); -}; - -template -struct indirection { - template - struct inner { - BOOST_STATIC_CONSTANT(unsigned,value=Indirection); - }; -}; - -template<>//pointer -struct indirection { - template - struct inner { - template - static char (*test(U*))[cv_type::value]; - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(*test((T)NULL) )); - }; -}; - -template<>//reference -struct indirection { - template - struct inner { - static T (*function)(); - - template - static char (*test(U& (*)()))[cv_type::value]; - - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(*test(function))); - }; -}; - -template<>//array -struct indirection { - template - struct inner { - template - static char (*test(U []))[cv_type::value]; - - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(*test(*((T*)NULL)) )); - }; -}; - -template -struct modifier_category { - template - struct inner { - BOOST_STATIC_CONSTANT(unsigned,value=NO_MODIFIERS+cv); - }; - template<> - struct inner<0> { - BOOST_STATIC_CONSTANT(int,indir= ( - //boost::is_function::value?FUNCTION_OR_MEMBER_ID: - boost::is_array::value?ARRAY_ID: - boost::type_of::is_pointer::value?POINTER_ID: - boost::is_reference::value?REFERENCE_ID: - NO_MODIFIERS - )); - BOOST_STATIC_CONSTANT(unsigned,value=indirection::inner::value); - }; - - BOOST_STATIC_CONSTANT(unsigned,cv=boost::is_array::value?0:boost::is_const::value+boost::is_volatile::value*2); - BOOST_STATIC_CONSTANT(unsigned,value=inner::value); -}; - -template<> -struct modifier_category -{ - BOOST_STATIC_CONSTANT(unsigned,value=VOID_ID); -}; - -}} //namespace boost::type_of - -#endif //BOOST_TYPEOF_VINTAGE_MODIFIER_CATEGORY_HPP_INCLUDED - diff --git a/include/boost/typeof/vintage/modifier_pointer.hpp b/include/boost/typeof/vintage/modifier_pointer.hpp deleted file mode 100644 index 1d8cf2e..0000000 --- a/include/boost/typeof/vintage/modifier_pointer.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -template<> -struct encode_impl -{ - template - struct encoder { - typedef void(*function_ptr)( - sizer, - typename mpl::next::type, - T, - Types - ); - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL)))); - - friend sizer encode_value(const sizer&,const sizer&); - }; -}; - -template -typename encode_modifier::encoded_type encode(void(*)(sizer,V,T BOOST_TYPEOF_qualifier *,Types)); - -template<> -struct decode_impl -{ - template - struct decoder { - typedef typename decode_impl::decoder decode0; - typedef typename decode0::type BOOST_TYPEOF_qualifier * type; - typedef typename decode0::iter iter; - }; -}; diff --git a/include/boost/typeof/vintage/modifier_qualifier.hpp b/include/boost/typeof/vintage/modifier_qualifier.hpp deleted file mode 100644 index 4fb887b..0000000 --- a/include/boost/typeof/vintage/modifier_qualifier.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -template<> -struct encode_impl -{ - template - struct encoder { - typedef void(*function_ptr)( - sizer, - typename mpl::next::type, - T*, - Types - ); - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL)))); - - friend sizer encode_value(const sizer&,const sizer&); - }; -}; - -template -typename encode_modifier::encoded_type encode(void(*)(sizer,V,T BOOST_TYPEOF_qualifier *,Types)); - -template<> -struct decode_impl -{ - template - struct decoder { - typedef typename decode_impl::decoder decode0; - typedef typename decode0::type BOOST_TYPEOF_qualifier type; - typedef typename decode0::iter iter; - }; -}; diff --git a/include/boost/typeof/vintage/modifier_reference.hpp b/include/boost/typeof/vintage/modifier_reference.hpp deleted file mode 100644 index 5deb68f..0000000 --- a/include/boost/typeof/vintage/modifier_reference.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -template<> -struct encode_impl -{ - template - struct encoder { - typedef T(*function_ptr)( - sizer, - typename mpl::next::type, - Types - ); - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL)))); - - friend sizer encode_value(const sizer&,const sizer&); - }; -}; - -template -typename encode_modifier::encoded_type encode(T BOOST_TYPEOF_qualifier& (*)(sizer,V,Types)); - -template<> -struct decode_impl -{ - template - struct decoder { - typedef typename decode_impl::decoder decode0; - typedef typename decode0::type BOOST_TYPEOF_qualifier & type; - typedef typename decode0::iter iter; - }; -}; diff --git a/include/boost/typeof/vintage/modifiers.hpp b/include/boost/typeof/vintage/modifiers.hpp deleted file mode 100644 index 423ee3c..0000000 --- a/include/boost/typeof/vintage/modifiers.hpp +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_VINTAGE_TYPEOF_MODIFIERS_HPP_INCLUDED -#define BOOST_VINTAGE_TYPEOF_MODIFIERS_HPP_INCLUDED - -#include -#include -#include - -namespace boost { namespace type_of { - -sizer<0xffff> encode(...); -template -struct validate_type { - template - struct Type_Not_Registered_With_Typeof_System { - typedef int type; - }; -}; - -template<> -struct validate_type<0xffff> { - template - struct Type_Not_Registered_With_Typeof_System { - }; -}; - -template<> -struct encode_impl -{ - template - struct encoder { - typedef T const& (*function_ptr)(V,Types); - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL)))); - /* - If T is a simple type, use BOOST_TYPEOF_REGISTER_TYPE - if T is a simple template type (containing only typenames) use BOOST_TYPEOF_REGISTER_TEMPLATE - If T is a complex template type (containing integral constants) use BOOST_TYPEOF_REGISTER_TEMPLATE_X - If T is a nested class, you need to use BOOST_TYPEOF_REGISTER_TYPE for every concrete instantiation of that class. - */ - typedef validate_type::Type_Not_Registered_With_Typeof_System::type type_validation; - }; -}; - -template<> -struct encode_impl -{ - template - struct encoder { - typedef T& (*function_ptr)(V,Types); - BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL)))); - }; -}; - -template<> -struct encode_impl -{ - template - struct encoder { - BOOST_STATIC_CONSTANT(unsigned,value= - sizeof( - typename encode_modifier< - typename mpl::next::type, - typename Types::type, - typename Types::next - >::encoded_type - ) - ); - friend sizer encode_value(const sizer&,const sizer&); - }; -}; - -template<> -struct decode_impl -{ - template - struct decoder { - typedef void type; - typedef Iter iter; - }; -}; - -#define BOOST_TYPEOF_qualifier -#define n 0 -#include -#include -#include -#undef n -#undef BOOST_TYPEOF_qualifier - -#define BOOST_TYPEOF_qualifier const -#define n 1 -#include -#include -#include -#include -#undef n -#undef BOOST_TYPEOF_qualifier - -#define BOOST_TYPEOF_qualifier volatile -#define n 2 -#include -#include -#include -#include -#undef n -#undef BOOST_TYPEOF_qualifier - -#define BOOST_TYPEOF_qualifier const volatile -#define n 3 -#include -#include -#include -#include -#undef n -#undef BOOST_TYPEOF_qualifier - -}} //namespace boost::type_of - -#endif //BOOST_VINTAGE_TYPEOF_MODIFIERS_HPP_INCLUDED \ No newline at end of file diff --git a/include/boost/typeof/vintage/pointers_data_members.hpp b/include/boost/typeof/vintage/pointers_data_members.hpp deleted file mode 100644 index 3869eed..0000000 --- a/include/boost/typeof/vintage/pointers_data_members.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_POINTERS_DATA_MEMBERS_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_POINTERS_DATA_MEMBERS_HPP_INCLUDED - -#include -#include - -#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() - -namespace boost { namespace type_of{ - enum {PTR_DATA_MEM_ID = BOOST_TYPEOF_UNIQUE_ID()}; - - template<> - struct encode_impl - { - template - struct encoder { - typedef Types types_2; - typedef type_list< T, types_2 > types_1; - typedef type_list< R, types_1 > types_0; - BOOST_STATIC_CONSTANT(unsigned,value= - sizeof( - typename encode_modifier< - typename mpl::next::type, - typename types_0::type, - types_1 - >::encoded_type - ) - ); - friend sizer encode_value(const sizer&,const sizer&); - }; - }; - template - typename encode_impl::template encoder - encode(R (T::* const&(*function)(V,Types))); - - template<> struct decode_impl { - template - struct decoder { - typedef Iter iter0; - BOOST_TYPEOF_DECODE_PARAMS(2) - - template struct workaround{ - typedef R (T::*type); - }; - template<> struct workaround{ - typedef int type; - }; - - typedef workaround::type type; - typedef iter2 iter; - }; - }; -}} //namespace boost::type_of - -#endif //BOOST_TYPEOF_REGISTER_MEMBER_POINTER_HPP_HOLT_2004_1015 \ No newline at end of file diff --git a/include/boost/typeof/vintage/register_functions_iterate.hpp b/include/boost/typeof/vintage/register_functions_iterate.hpp deleted file mode 100644 index 2c772dd..0000000 --- a/include/boost/typeof/vintage/register_functions_iterate.hpp +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#define n BOOST_PP_ITERATION() - -template<> -struct encode_impl -{ - template - struct encoder { - typedef Types BOOST_PP_CAT(types_,n); - BOOST_PP_REPEAT(n,BOOST_TYPEOF_PUSH_FRONT,n) - BOOST_STATIC_CONSTANT(int,instantiate = - sizeof( - encode_modifier< - mpl::next::type, - R, - types_0 - >::encoded_type - ) - ); - friend sizer encode_value(const sizer&,const sizer&); - }; -}; - -template -typename encode_impl::template encoder -encode(R (& (*function)(V,Types))(BOOST_PP_ENUM_PARAMS(n,P)) ); - -template<> -struct decode_impl -{ - template - struct decoder { - typedef Iter iterR; - typedef decode_impl::decoder decodeR; - typedef typename decodeR::type R; - typedef typename decodeR::iter iter0; - BOOST_TYPEOF_DECODE_PARAMS(n); - typedef R (&type)(BOOST_PP_ENUM_PARAMS(n,P)); - typedef BOOST_PP_CAT(iter,n) iter; - }; -}; - -template<> -struct encode_impl -{ - template - struct encoder { - typedef Types BOOST_PP_CAT(types_,n); - BOOST_PP_REPEAT(n,BOOST_TYPEOF_PUSH_FRONT,n) - BOOST_STATIC_CONSTANT(int,instantiate = - sizeof( - encode_modifier< - mpl::next::type, - R, - types_0 - >::encoded_type - ) - ); - friend sizer encode_value(const sizer&,const sizer&); - }; -}; - -template -typename encode_impl::template encoder -encode(R (* const& (*function)(V,Types))(BOOST_PP_ENUM_PARAMS(n,P)) ); - -template<> -struct decode_impl -{ - template - struct decoder { - typedef Iter iterR; - typedef decode_impl::decoder decodeR; - typedef typename decodeR::type R; - typedef typename decodeR::iter iter0; - BOOST_TYPEOF_DECODE_PARAMS(n); - typedef R (*type)(BOOST_PP_ENUM_PARAMS(n,P)); - typedef BOOST_PP_CAT(iter,n) iter; - }; -}; - -#define BOOST_TYPEOF_qualifier -#define BOOST_TYPEOF_id MEM_FUN_ID - -#include - -#define BOOST_TYPEOF_qualifier const -#define BOOST_TYPEOF_id CONST_MEM_FUN_ID - -#include - -#define BOOST_TYPEOF_qualifier volatile -#define BOOST_TYPEOF_id VOLATILE_MEM_FUN_ID - -#include - -#define BOOST_TYPEOF_qualifier volatile const -#define BOOST_TYPEOF_id VOLATILE_CONST_MEM_FUN_ID - -#include - -#undef n \ No newline at end of file diff --git a/include/boost/typeof/vintage/register_mem_functions.hpp b/include/boost/typeof/vintage/register_mem_functions.hpp deleted file mode 100644 index f4bbc44..0000000 --- a/include/boost/typeof/vintage/register_mem_functions.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -//member functions -//This file must not be included directly. - -template<> -struct encode_impl -{ - template - struct encoder { - typedef Types BOOST_PP_CAT(types_,n); - BOOST_PP_REPEAT(n,BOOST_TYPEOF_PUSH_FRONT,n) - BOOST_STATIC_CONSTANT(int,instantiate = - sizeof( - encode_modifier< - mpl::next::type, - R, - type_list - >::encoded_type - ) - ); - friend sizer encode_value(const sizer&,const sizer&); - }; -}; - -template -typename encode_impl::template encoder -encode(R (T::* const&(*function)(V,Types))(BOOST_PP_ENUM_PARAMS(n,P)) BOOST_TYPEOF_qualifier); - -template<> -struct decode_impl -{ - template - struct decoder { - typedef Iter iterR; - typedef decode_impl::decoder decodeR;\ - typedef typename decodeR::type R; - typedef typename decodeR::iter iterT; - typedef decode_impl::decoder decodeT;\ - typedef typename decodeT::type T; - typedef typename decodeT::iter iter0; - BOOST_TYPEOF_DECODE_PARAMS(n) - template - struct workaround { - typedef R_ (T_::*type)(BOOST_PP_ENUM_PARAMS(n,P_)) BOOST_TYPEOF_qualifier; - }; - template<> - struct workaround { - typedef int type; - }; - typedef workaround::type type; - typedef BOOST_PP_CAT(iter,n) iter; - }; -}; - -#undef BOOST_TYPEOF_id -#undef BOOST_TYPEOF_qualifier diff --git a/include/boost/typeof/vintage/sizer.hpp b/include/boost/typeof/vintage/sizer.hpp deleted file mode 100644 index dbbde34..0000000 --- a/include/boost/typeof/vintage/sizer.hpp +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_SIZER_HPP_HOLT_2004_0819 -#define BOOST_TYPEOF_SIZER_HPP_HOLT_2004_0819 - -#ifdef BOOST_MAX_RECURSION -#include -#include -#endif - -namespace boost{namespace type_of { - -/* -The reason for a sizer class to extract the size of a type from, -is that using the size of a function returning an array limits the size of the array to 0x7FFFFFF -(At least on VC 6.5) This is ok when representing type identifiers, -but not when representing integral types such as mpl::int_<0xFFFFFFFF>. -Also, VC 7.0 does not do well with function references returning an array ( char (&f())[N];) -sizer can be used to represent any number from 1 to 0xFFFFFFFF. -*/ -template -struct sizer { - enum {value1=S/2}; - enum {value2=S-S/2}; - char a[value1]; - char b[value2]; -}; - -template<> -struct sizer<1> { - char type; -}; - -template<> -struct sizer<0xFFFFFFFF> { - char a[0x7FFFFFFF]; - char b[0x7FFFFFFF]; - char c; -}; - -template<> -struct sizer<0> { - //Unable to represent a type with zero size. -}; - -template struct encode_counter : encode_counter {}; -template<> struct encode_counter<0> {}; - -#ifdef BOOST_MAX_RECURSION -#define BOOST_TYPEOF_SPECIALIZE_ENCODE_COUNTER(z,n,text)\ -template<> struct encode_counter {}; - -BOOST_PP_REPEAT(20,BOOST_TYPEOF_SPECIALIZE_ENCODE_COUNTER,_) -#undef BOOST_TYPEOF_SPECIALIZE_ENCODE_COUNTER - - -template -struct counter_start -{ - template - struct increase_limit { - BOOST_STATIC_CONSTANT(unsigned,value=(counter_start::value)); - }; - template<> - struct increase_limit - { - BOOST_STATIC_CONSTANT(unsigned,value=N-1); - }; - BOOST_STATIC_CONSTANT(unsigned,current=N-1); - BOOST_STATIC_CONSTANT(unsigned,next=N+BOOST_MAX_RECURSION-1); - - BOOST_STATIC_CONSTANT(bool,exceed_current=(sizeof(encode_index((encode_counter*)NULL))==current)); - BOOST_STATIC_CONSTANT(bool,start_next=(sizeof(encode_index((encode_counter*)NULL))>1)); - BOOST_STATIC_CONSTANT(unsigned,value=(increase_limit::value)); - typedef encode_counter type; -}; - -#define BOOST_TYPEOF_INDEX(T) (sizeof(boost::type_of::encode_index((boost::type_of::counter_start::type*)0))) -#else - -#define BOOST_TYPEOF_INDEX(T) (sizeof(boost::type_of::encode_index((boost::type_of::encode_counter*)0))) - -#endif - -#define BOOST_TYPEOF_VALUE(A,B) (sizeof(boost::type_of::encode_value(A(),B()))) - - -sizer<1> encode_value(...); -//Need a large starting value, due to MSVC's ETI errors. -sizer encode_index(...); -/* -#define BOOST_TYPEOF_VALUE(N) (sizeof(boost::type_of::encode_value((boost::type_of::encode_counter*)0))) -#define BOOST_TYPEOF_INDEX() (sizeof(*boost::type_of::encode_index((boost::type_of::encode_counter*)0))) -*/ - -}}//namespace boost::type_of - -#endif //BOOST_TYPEOF_SIZER_HPP_HOLT_2004_0819 - diff --git a/include/boost/typeof/vintage/template_encoding.hpp b/include/boost/typeof/vintage/template_encoding.hpp deleted file mode 100644 index ad99be6..0000000 --- a/include/boost/typeof/vintage/template_encoding.hpp +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_TEMPLATE_ENCODING_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_TEMPLATE_ENCODING_HPP_INCLUDED - -#include -#include -#include -#include -#include -#include -#include -#include -//#include - -#include -#include -#include -#include -#include -#include - -// - -#define BOOST_TYPEOF_PARAM_CAST(Param)\ - BOOST_PP_CAT(BOOST_TYPEOF_CAST_, BOOST_PP_SEQ_ELEM(0, Param)) - -// -#define BOOST_TYPEOF_PARAM_GETTYPE(obj) BOOST_TYPEOF_VIRTUAL(EXPANDTYPE, obj)(obj) -// - -#define BOOST_TYPEOF_TYPE_PARAM_ENCODE(This, n)\ - BOOST_PP_CAT(P, n) - -#define BOOST_TYPEOF_TYPE_PARAM_DECODE(This, n)\ - typedef typename decode_impl::\ - decoder BOOST_PP_CAT(d,n);\ - typedef typename BOOST_PP_CAT(d,n)::type BOOST_PP_CAT(P,n);\ - typedef typename BOOST_PP_CAT(d,n)::iter BOOST_PP_CAT(iter,BOOST_PP_INC(n)); - -#define BOOST_TYPEOF_TYPE_PARAM_CAST(This, n)\ - BOOST_PP_CAT(P,n) - -// - -#define BOOST_TYPEOF_INTEGRAL_PARAM_ENCODE(This, n)\ - integral_wrapper<\ - BOOST_PP_CAT(P, n)\ - > - -#define BOOST_TYPEOF_INTEGRAL_PARAM_DECODE(This, n)\ - typedef decode_integral BOOST_PP_CAT(d,n);\ - BOOST_STATIC_CONSTANT(BOOST_TYPEOF_PARAM_GETTYPE(This),BOOST_PP_CAT(P,n)=(TYPEOF_GET_VALUE(BOOST_PP_CAT(d,n))));\ - typedef typename BOOST_PP_CAT(d,n)::iter BOOST_PP_CAT(iter,BOOST_PP_INC(n)); - -#define BOOST_TYPEOF_INTEGRAL_PARAM_CAST(This, n)\ - BOOST_TYPEOF_PARAM_GETTYPE(This)(BOOST_PP_CAT(P,n)) - -// - -#define BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM(r, data, n, elem)\ - BOOST_TYPEOF_VIRTUAL(DECODE, elem)(elem, n) - -#define BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM(r, data, n, elem)\ - , BOOST_TYPEOF_VIRTUAL(ENCODE, elem)(elem, n) - -#define BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_PAIR(r, data, n, elem)\ - BOOST_PP_COMMA_IF(n) BOOST_TYPEOF_PARAM_GETTYPE(elem) BOOST_PP_CAT(P, n) - -#define BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_CAST(r, data, n, elem)\ - BOOST_PP_COMMA_IF(n) BOOST_TYPEOF_VIRTUAL(CAST, elem)(elem, n) - -// - -#define BOOST_TYPEOF_ENCODE_TEMPLATE_IMPL(Name, Params, Size, ID)\ - template<>\ - struct encode_impl\ - {\ - template\ - struct encoder {\ - typedef Types BOOST_PP_CAT(types_,Size);\ - BOOST_PP_REPEAT(Size,BOOST_TYPEOF_PUSH_FRONT,Size)\ - BOOST_STATIC_CONSTANT(int,value =sizeof(BOOST_DEDUCED_TYPENAME encode_modifier::type,BOOST_DEDUCED_TYPENAME types_0::type,types_1>::encoded_type));\ - friend sizer encode_value(const sizer&,const sizer&);\ - };\ - };\ - template<\ - BOOST_PP_SEQ_FOR_EACH_I(\ - BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_PAIR,\ - ~,\ - Params\ - ),typename V,typename Types>\ - typename encode_impl::\ - encoder<\ - V\ - BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM,~,Params),\ - Types\ - > encode(Name const& (*)(V,Types)); - -#define BOOST_TYPEOF_DECODE_TEMPLATE_IMPL(Name, Params, Size, ID)\ - template<>\ - struct decode_impl\ - {\ - template\ - struct decoder {\ - typedef Iter iter0;\ - BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM,~,Params)\ - typedef Name type;\ - typedef BOOST_PP_CAT(iter,Size) iter;\ - };\ - }; - -#define BOOST_TYPEOF_REGISTER_TEMPLATE_IMPL(Name, Params, Size, ID)\ - namespace boost { namespace type_of{\ - BOOST_TYPEOF_ENCODE_TEMPLATE_IMPL(Name, Params, Size, ID)\ - BOOST_TYPEOF_DECODE_TEMPLATE_IMPL(Name, Params, Size, ID)\ - }} - - -#endif //BOOST_VINTAGE_TEMPLATE_ENCODING_HPP_INCLUDED diff --git a/include/boost/typeof/vintage/type_encoding.hpp b/include/boost/typeof/vintage/type_encoding.hpp deleted file mode 100644 index cf5ce8d..0000000 --- a/include/boost/typeof/vintage/type_encoding.hpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_TYPE_ENCODING_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_TYPE_ENCODING_HPP_INCLUDED - -#include - -#define BOOST_TYPEOF_ENCODE_TYPE(simple_type)\ - template<>\ - struct encode_impl\ - {\ - template\ - struct encoder {\ - BOOST_STATIC_CONSTANT(unsigned,value=\ - sizeof(\ - typename encode_modifier<\ - typename mpl::next::type,\ - typename Types::type,\ - typename Types::next\ - >::encoded_type\ - )\ - );\ - friend sizer encode_value(const sizer&,const sizer&);\ - };\ - };\ - template\ - typename encode_impl::encoder encode(simple_type const& (*)(V,Types)); - -#define BOOST_TYPEOF_DECODE_TYPE(simple_type)\ - template<>\ - struct decode_impl\ - {\ - template\ - struct decoder {\ - typedef simple_type type;\ - typedef Iter iter;\ - };\ - };\ - -#define BOOST_TYPEOF_REGISTER_TYPE(simple_type)\ -namespace boost { namespace type_of{\ -BOOST_TYPEOF_ENCODE_TYPE(simple_type)\ -BOOST_TYPEOF_DECODE_TYPE(simple_type)\ -}}//namespace boost::type_of - -#endif //BOOST_TYPEOF_VINTAGE_TYPE_ENCODING_HPP_INCLUDED \ No newline at end of file diff --git a/include/boost/typeof/vintage/type_list.hpp b/include/boost/typeof/vintage/type_list.hpp deleted file mode 100644 index 3765648..0000000 --- a/include/boost/typeof/vintage/type_list.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_TYPE_LIST_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_TYPE_LIST_HPP_INCLUDED - -namespace boost{ namespace type_of{ - struct empty_type_list { - typedef empty_type_list type; - typedef empty_type_list next; - }; - template - struct type_list { - typedef T type; - typedef Next next; - }; - - template - int - encode(empty_type_list const& (*)(V,Types)); - -}}//namespace boost::type_of - -#endif //BOOST_TYPEOF_VINTAGE_TYPE_LIST_HPP_INCLUDED - diff --git a/include/boost/typeof/vintage/type_to_macro.hpp b/include/boost/typeof/vintage/type_to_macro.hpp deleted file mode 100644 index 2a01b1d..0000000 --- a/include/boost/typeof/vintage/type_to_macro.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_TYPE_TO_MACRO_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_TYPE_TO_MACRO_HPP_INCLUDED - -#include -#include -#include - -/* -These macros are used to dechifer template arguments into sensible macros. -There are three predefined macro builders: -BOOST_TYPEOF_typename - for class and typename arguments -BOOST_TYPEOF_integral - for signed integral values, int,short,char,bool, etc. -BOOST_TYPEOF_unsigned_integral - for unsigned integral values, unsigned, unsigned long etc. - -All the fundamental integral types (except long long) have been pre-registered. -In order to implement new template argument types (enums), -you need to define a macro containing the name of the enum: - -enum MyEnum {red=0,green=1,blue=2}; -#define BOOST_TYPEOF__MyEnum__ BOOST_TYPEOF_integral - -//MyEnum is now treated as an integral value in template expressions. - -template -struct enum_class {}; - -//Is registered using -BOOST_TYPEOF_DEFINE_TEMPLATE(enum_class,1,(MyEnum)) -*/ - -#define BOOST_TYPEOF_typename(dummy,append,arg) BOOST_PP_CAT(BOOST_TYPEOF_typename_,append)arg -#define BOOST_TYPEOF_integral(dummy,append,arg) BOOST_PP_CAT(BOOST_TYPEOF_integral_,append)arg -#define BOOST_TYPEOF_unsigned_integral(dummy,append,arg) BOOST_PP_CAT(BOOST_TYPEOF_unsigned_integral_,append)arg - -#define BOOST_TYPEOF__typename__ BOOST_TYPEOF_typename BOOST_PP_LPAREN() dummy -#define BOOST_TYPEOF__class__ BOOST_TYPEOF_typename BOOST_PP_LPAREN() dummy -#define BOOST_TYPEOF__bool__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy -#define BOOST_TYPEOF__char__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy -#define BOOST_TYPEOF__short__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy -#define BOOST_TYPEOF__int__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy -#define BOOST_TYPEOF__long__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy -#define BOOST_TYPEOF__unsigned__ BOOST_TYPEOF_unsigned_integral BOOST_PP_LPAREN() dummy -#define BOOST_TYPEOF__signed__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy -#define BOOST_TYPEOF__size_t__ BOOST_TYPEOF_unsigned_integral BOOST_PP_LPAREN() dummy -#define BOOST_TYPEOF__unsigned BOOST_TYPEOF_unsigned_integral BOOST_PP_LPAREN() -#define BOOST_TYPEOF__signed BOOST_TYPEOF_integral BOOST_PP_LPAREN() - - -#define BOOST_TYPEOF_WRAP2(expr) expr -#define BOOST_TYPEOF_WRAP1(expr) BOOST_TYPEOF_WRAP2 expr - -#define BOOST_TYPEOF_ENCODE_ARGUMENT(z,n,text)\ - BOOST_TYPEOF_WRAP1((BOOST_PP_CAT(BOOST_TYPEOF__,BOOST_PP_CAT(text,__)),encode,(BOOST_PP_CAT(A,n)) BOOST_PP_RPAREN())) - -#define BOOST_TYPEOF_ENCODE_SEQ_ELEMENT(z,n,seq)\ - BOOST_TYPEOF_ENCODE_ARGUMENT(z,n,BOOST_PP_SEQ_ELEM(n, seq)) - -#define BOOST_TYPEOF_DECODE_ARGUMENT(z,n,text)\ - BOOST_TYPEOF_WRAP1((BOOST_PP_CAT(BOOST_TYPEOF__,BOOST_PP_CAT(text,__)),decode,(n,text) BOOST_PP_RPAREN())) - -#define BOOST_TYPEOF_DECODE_SEQ_ELEMENT(z,n,seq)\ - BOOST_TYPEOF_DECODE_ARGUMENT(z,n,BOOST_PP_SEQ_ELEM(n, seq)) - -#endif //BOOST_VINTAGE_TYPE_TO_MACRO_HPP_INCLUDED - diff --git a/include/boost/typeof/vintage/typeof_impl.hpp b/include/boost/typeof/vintage/typeof_impl.hpp deleted file mode 100644 index cdd66bb..0000000 --- a/include/boost/typeof/vintage/typeof_impl.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2004 Peder Holt -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPEOF_VINTAGE_TYPEOF_IMPL_HPP_INCLUDED -#define BOOST_TYPEOF_VINTAGE_TYPEOF_IMPL_HPP_INCLUDED - -#include -#include -namespace boost -{ - namespace type_of - { - template - struct iterator { - BOOST_STATIC_CONSTANT(unsigned,index=Index); - BOOST_STATIC_CONSTANT(unsigned,pos=Position); - typedef iterator next; - }; - - template - struct encode_type - { - BOOST_STATIC_CONSTANT(unsigned,value=BOOST_TYPEOF_INDEX(T)); - BOOST_STATIC_CONSTANT(unsigned,encode_dummy=sizeof(BOOST_DEDUCED_TYPENAME encode_modifier,T,empty_type_list>::encoded_type)); - - BOOST_STATIC_CONSTANT(unsigned,next=value+1); - friend sizer encode_index(encode_counter*); - - sizer resize; - }; - - template - encode_type encode_start(T const&); - - template - struct decode { - typedef typename decode_impl::decoder::type type; - }; - template<> - struct decode { - typedef int type; - }; - template - struct value_iterator { - BOOST_STATIC_CONSTANT(unsigned,pos=Position); - BOOST_STATIC_CONSTANT(unsigned,value=BOOST_TYPEOF_VALUE(sizer,sizer)); - typedef value_iterator next; - }; - } -} - -#define BOOST_TYPEOF(expr) \ - boost::type_of::decode >::type - -#define BOOST_TYPEOF_TPL(expr) typename BOOST_TYPEOF(expr) - - -#endif//BOOST_TYPEOF_VINTAGE_TYPEOF_IMPL_HPP_INCLUDED - - diff --git a/test/compliant/odr.hpp b/test/compliant/odr.hpp index d37fb34..040539c 100755 --- a/test/compliant/odr.hpp +++ b/test/compliant/odr.hpp @@ -12,6 +12,55 @@ void odr_test2(); // trying to cause ODR violation in a class template +#include + +void odr_test1(); +void odr_test2(); + +#if BOOST_WORKAROUND(BOOST_MSVC,==1200) + +// trying to cause ODR violation in a class template + +template +class sum_t +{ +public: +// VC7 fails using template types in typeof expression. + typedef BOOST_TYPEOF_TPL(T() + U()) result_type; + + sum_t(const T& t, const U& u); + BOOST_TYPEOF_TPL(T() + U()) operator()(); +private: + BOOST_TYPEOF_TPL(T() + U()) m_sum; +}; + +template +sum_t::sum_t(const T& t, const U& u) +: m_sum(t + u) +{} + +template +typename sum_t::result_type sum_t::operator()() +{ +// BOOST_AUTO_TPL(result, m_sum); + return m_sum; +} + +template +sum_t make_sum(const T& t, const U& u) +{ + return sum_t(t, u); +} + +// trying to cause ODR violation in a function template + +template +typename sum_t::result_type sum(const T& t, const U& u) +{ + BOOST_AUTO_TPL(result, t + u); + return result; +} +#elif !BOOST_WORKAROUND(BOOST_MSVC,==1300) template class sum_t { @@ -44,5 +93,6 @@ typename sum_t::result_type sum(const T& t, const U& u) BOOST_AUTO_TPL(result, t + u); return result; } +#endif #endif//ODR_HPP_INCLUDED diff --git a/test/compliant/odr1.cpp b/test/compliant/odr1.cpp index e8dd509..14bbd8d 100755 --- a/test/compliant/odr1.cpp +++ b/test/compliant/odr1.cpp @@ -3,7 +3,6 @@ // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) #include -#if !defined(_MSC_VER) || _MSC_VER > 0x0700 #include #include "odr.hpp" @@ -12,12 +11,13 @@ using namespace std; void odr_test1() { +#if! BOOST_WORKAROUND(BOOST_MSVC,==1300) char i = 5; double d = 3.14; cout << sum(d, i) << endl; cout << sum(i, d) << endl; cout << make_sum(d, i)() << endl; cout << make_sum(i, d)() << endl; +#endif } -#endif//BOOST_TYPEOF_VINTAGE diff --git a/test/compliant/odr2.cpp b/test/compliant/odr2.cpp index 8672bf3..783a157 100755 --- a/test/compliant/odr2.cpp +++ b/test/compliant/odr2.cpp @@ -2,9 +2,6 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#include -#if !defined(_MSC_VER) || _MSC_VER > 0x0700 - #include #include "odr.hpp" @@ -12,12 +9,12 @@ using namespace std; void odr_test2() { +#if! BOOST_WORKAROUND(BOOST_MSVC,==1300) char i = 5; double d = 3.14; cout << sum(d, i) << endl; cout << sum(i, d) << endl; cout << make_sum(d, i)() << endl; cout << make_sum(i, d)() << endl; +#endif } - -#endif //BOOST_TYPEOF_VINTAGE diff --git a/test/main.cpp b/test/main.cpp index 4791f64..ab8bce8 100755 --- a/test/main.cpp +++ b/test/main.cpp @@ -325,14 +325,10 @@ namespace test_integral void odr_test() { -#if !defined(_MSC_VER) || _MSC_VER > 0x0700 - void odr_test1(); void odr_test2(); odr_test1(); odr_test2(); - -#endif//BOOST_TYPEOF_VINTAGE } #define BOOST_TYPEOF_TEXT "main()..." diff --git a/test/vintage/odr.hpp b/test/odr.hpp similarity index 58% rename from test/vintage/odr.hpp rename to test/odr.hpp index a1e564a..040539c 100644 --- a/test/vintage/odr.hpp +++ b/test/odr.hpp @@ -10,7 +10,14 @@ void odr_test1(); void odr_test2(); -#if! BOOST_WORKAROUND(BOOST_MSVC,==1300) +// trying to cause ODR violation in a class template + +#include + +void odr_test1(); +void odr_test2(); + +#if BOOST_WORKAROUND(BOOST_MSVC,==1200) // trying to cause ODR violation in a class template @@ -47,6 +54,39 @@ sum_t make_sum(const T& t, const U& u) // trying to cause ODR violation in a function template +template +typename sum_t::result_type sum(const T& t, const U& u) +{ + BOOST_AUTO_TPL(result, t + u); + return result; +} +#elif !BOOST_WORKAROUND(BOOST_MSVC,==1300) +template +class sum_t +{ +public: + typedef BOOST_TYPEOF_TPL(T() + U()) result_type; + + sum_t(const T& t, const U& u) + : m_sum(t + u) + {} + BOOST_TYPEOF_TPL(T() + U()) operator()() + { + BOOST_AUTO_TPL(result, m_sum); + return result; + } +private: + BOOST_TYPEOF_TPL(T() + U()) m_sum; +}; + +template +sum_t make_sum(const T& t, const U& u) +{ + return sum_t(t, u); +} + +// trying to cause ODR violation in a function template + template typename sum_t::result_type sum(const T& t, const U& u) { diff --git a/test/vintage/odr1.cpp b/test/odr1.cpp similarity index 92% rename from test/vintage/odr1.cpp rename to test/odr1.cpp index e4b030d..14bbd8d 100644 --- a/test/vintage/odr1.cpp +++ b/test/odr1.cpp @@ -2,6 +2,8 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) +#include + #include #include "odr.hpp" @@ -18,3 +20,4 @@ void odr_test1() cout << make_sum(i, d)() << endl; #endif } + diff --git a/test/vintage/odr2.cpp b/test/odr2.cpp similarity index 100% rename from test/vintage/odr2.cpp rename to test/odr2.cpp diff --git a/test/vintage/mpl/register.hpp b/test/vintage/mpl/register.hpp deleted file mode 100644 index a4c6188..0000000 --- a/test/vintage/mpl/register.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2004 Arkadiy Vertleyb -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef MPL_REGISTER_HPP_INCLUDED -#define MPL_REGISTER_HPP_INCLUDED - -#include -#include - -#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() - -BOOST_TYPEOF_REGISTER_TYPE(boost::mpl::vector0<>); -BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::vector1, 1); -BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::vector2, 2); -BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::vector3, 3); -BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::vector4, 4); - -#endif//MPL_REGISTER_HPP_INCLUDED diff --git a/test/vintage/stl/register.hpp b/test/vintage/stl/register.hpp deleted file mode 100644 index 8d93a00..0000000 --- a/test/vintage/stl/register.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2004 Arkadiy Vertleyb -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef STL_REGISTER_HPP_INCLUDED -#define STL_REGISTER_HPP_INCLUDED - -#include - -#include -#include -#include -#include - -#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() - -BOOST_TYPEOF_REGISTER_TEMPLATE_X(std::vector, (class)(class)); -BOOST_TYPEOF_REGISTER_TEMPLATE(std::list, 2); -BOOST_TYPEOF_REGISTER_TEMPLATE(std::set, 3); -BOOST_TYPEOF_REGISTER_TEMPLATE(std::allocator, 1); -BOOST_TYPEOF_REGISTER_TEMPLATE(std::less, 1); - -#endif//STL_REGISTER_HPP_INCLUDED diff --git a/test/vintage/typeid.hpp b/test/vintage/typeid.hpp deleted file mode 100644 index 7c61182..0000000 --- a/test/vintage/typeid.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2004 Arkadiy Vertleyb -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) - -#ifndef TYPEID_HPP_INCLUDED -#define TYPEID_HPP_INCLUDED - -#include - -template -struct typeid_base { - template - struct inner { - static std::string name() - { - return typeid(T).name(); - } - }; -}; - -template<> -struct typeid_base { - template - struct inner { - static std::string name() - { - return std::string(typeid(T).name())+"&"; - } - }; -}; - -template<> -struct typeid_base { - template - struct inner { - static std::string name() - { - return std::string(typeid(T).name())+" const"; - } - }; -}; - -template<> -struct typeid_base { - template - struct inner { - static std::string name() - { - return std::string(typeid(T).name())+" const&"; - } - }; -}; - -template struct type_id -: typeid_base::value,boost::is_const::value>::inner -{ -}; - -#endif//TYPEID_HPP_INCLUDED -