From 826341681627eb7f2669f26d7e3bcc46467dc34b Mon Sep 17 00:00:00 2001 From: Arkadiy Vertleyb Date: Sun, 20 Mar 2005 13:18:15 +0000 Subject: [PATCH] custom vector; compiler-neutral message; moved encode_type/decode_type to unnamed n/s; w/around what looks like ETI; shortcut reg. for tpl-tpl with only type params [SVN r2543] --- .../boost/typeof/compliant/concatenate.hpp | 39 +---- .../boost/typeof/compliant/encode_decode.hpp | 44 ++--- .../boost/typeof/compliant/int_encoding.hpp | 5 +- include/boost/typeof/compliant/modifiers.hpp | 6 +- .../typeof/compliant/template_encoding.hpp | 2 +- .../compliant/template_template_param.hpp | 4 +- .../boost/typeof/compliant/type_encoding.hpp | 2 +- .../boost/typeof/compliant/typeof_impl.hpp | 52 +++--- include/boost/typeof/compliant/vector.hpp | 151 ++++++++++++++++++ include/boost/typeof/message.hpp | 8 + include/boost/typeof/typeof.hpp | 6 +- test/boost-build.jam | 1 + test/compliant/odr1.cpp | 5 + test/compliant/odr2.cpp | 5 + test/compliant/test_compliant.cpp | 43 ++++- test/compliant/typeof.sln | 6 + test/compliant/typeof.vcproj | 105 ++++++++++++ test/compliant/typeof_g++.bat | 4 +- test/jamfile | 18 +++ test/jamrules | 0 test/main.cpp | 94 ++++++++--- 21 files changed, 470 insertions(+), 130 deletions(-) create mode 100755 include/boost/typeof/compliant/vector.hpp create mode 100755 include/boost/typeof/message.hpp create mode 100755 test/boost-build.jam create mode 100755 test/jamfile create mode 100755 test/jamrules diff --git a/include/boost/typeof/compliant/concatenate.hpp b/include/boost/typeof/compliant/concatenate.hpp index c5fd2d2..b09f76b 100755 --- a/include/boost/typeof/compliant/concatenate.hpp +++ b/include/boost/typeof/compliant/concatenate.hpp @@ -5,13 +5,7 @@ #ifndef BOOST_TYPEOF_CONCATENATE_HPP_INCLUDED #define BOOST_TYPEOF_CONCATENATE_HPP_INCLUDED -#include -#include - -#include -#include #include -#include #include // Assumes iter0 contains initial iterator @@ -32,36 +26,9 @@ #define BOOST_TYPEOF_ENCODE_PARAMS_END(z, n, text)\ , BOOST_PP_CAT(P, n)>::type -#define BOOST_TYPEOF_ENCODE_PARAMS(n, ID) \ - BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_BEGIN, ~) \ - typename BOOST_TYPEOF_PUSH_BACK >::type \ +#define BOOST_TYPEOF_ENCODE_PARAMS(n, ID) \ + BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_BEGIN, ~) \ + typename mpl::push_back >::type \ BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_END, ~) -// constant-time push_back for mpl::vector -// to be removed once real one is available from MPL - -#define BOOST_TYPEOF_spec_push_back(z, i, text) \ - template \ - struct push_back, T> \ - { \ - typedef BOOST_PP_CAT(mpl::vector, BOOST_PP_INC(i))< \ - BOOST_PP_ENUM_PARAMS(i, T) BOOST_PP_COMMA_IF(i) T \ - > type; \ - }; \ - -#define BOOST_TYPEOF_implement_push_back() \ - template struct push_back; \ - BOOST_PP_REPEAT( \ - BOOST_TYPEOF_LIMIT_SIZE, \ - BOOST_TYPEOF_spec_push_back, \ - ~ \ - ) \ - -namespace boost{namespace type_of{namespace detail{ - BOOST_TYPEOF_implement_push_back() -}}} - -#undef BOOST_TYPEOF_spec_push_back -#undef BOOST_TYPEOF_implement_push_back - #endif//BOOST_TYPEOF_CONCATENATE_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/encode_decode.hpp b/include/boost/typeof/compliant/encode_decode.hpp index 92d30cc..2ddbc1e 100755 --- a/include/boost/typeof/compliant/encode_decode.hpp +++ b/include/boost/typeof/compliant/encode_decode.hpp @@ -5,30 +5,30 @@ #ifndef BOOST_TYPEOF_ENCODE_DECODE_HPP_INCLUDED #define BOOST_TYPEOF_ENCODE_DECODE_HPP_INCLUDED -namespace boost -{ - namespace type_of +#include +#include + +namespace boost{namespace type_of{namespace{ + + template + struct encode_type_impl; + + template + struct decode_type_impl { - namespace - { - template - struct encode_type_impl; - - template - struct decode_type_impl; - } + typedef int type; // MSVC ETI workaround + }; - template - struct encode_type : encode_type_impl - {}; + template + struct encode_type : encode_type_impl + {}; - template - struct decode_type : decode_type_impl< - typename mpl::deref::type, - typename mpl::next::type - > - {}; - } -} + template + struct decode_type : decode_type_impl< + typename mpl::deref::type, + typename mpl::next::type + > + {}; +}}} #endif//BOOST_TYPEOF_ENCODE_DECODE_HPP_INCLUDED diff --git a/include/boost/typeof/compliant/int_encoding.hpp b/include/boost/typeof/compliant/int_encoding.hpp index 939d249..4763cef 100755 --- a/include/boost/typeof/compliant/int_encoding.hpp +++ b/include/boost/typeof/compliant/int_encoding.hpp @@ -6,7 +6,6 @@ #define BOOST_TYPEOF_INT_ENCODING_HPP_INCLUDED #include -#include #include namespace boost{namespace type_of{ @@ -54,14 +53,14 @@ namespace boost{namespace type_of{ //////////////////////////////// template= 0x3fffffff)> - struct encode_size_t : BOOST_TYPEOF_PUSH_BACK< + struct encode_size_t : mpl::push_back< V, boost::mpl::size_t::value> > {}; template - struct encode_size_t : BOOST_TYPEOF_PUSH_BACK : mpl::push_back::value> >::type, boost::mpl::size_t diff --git a/include/boost/typeof/compliant/modifiers.hpp b/include/boost/typeof/compliant/modifiers.hpp index 667bf15..a12e85c 100755 --- a/include/boost/typeof/compliant/modifiers.hpp +++ b/include/boost/typeof/compliant/modifiers.hpp @@ -17,7 +17,7 @@ {\ typedef\ typename encode_type<\ - typename BOOST_TYPEOF_PUSH_BACK<\ + typename mpl::push_back<\ V\ , mpl::size_t >::type\ , T>::type\ @@ -61,8 +61,8 @@ namespace boost{namespace type_of{namespace{ {\ typedef\ typename encode_type<\ - typename BOOST_TYPEOF_PUSH_BACK<\ - typename BOOST_TYPEOF_PUSH_BACK<\ + typename mpl::push_back<\ + typename mpl::push_back<\ V\ , mpl::size_t >::type\ , mpl::size_t >::type\ diff --git a/include/boost/typeof/compliant/template_encoding.hpp b/include/boost/typeof/compliant/template_encoding.hpp index 7ca3f86..d1682bf 100755 --- a/include/boost/typeof/compliant/template_encoding.hpp +++ b/include/boost/typeof/compliant/template_encoding.hpp @@ -57,7 +57,7 @@ >\ struct encode_type_impl >\ {\ - typedef typename BOOST_TYPEOF_PUSH_BACK >::type V0;\ + 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;\ };\ diff --git a/include/boost/typeof/compliant/template_template_param.hpp b/include/boost/typeof/compliant/template_template_param.hpp index 32400e2..969a505 100644 --- a/include/boost/typeof/compliant/template_template_param.hpp +++ b/include/boost/typeof/compliant/template_template_param.hpp @@ -19,7 +19,7 @@ (Params) #define BOOST_TYPEOF_TEMPLATE_PARAM_GETPARAMS(This)\ - BOOST_PP_SEQ_ELEM(1, This) + BOOST_TYPEOF_TOSEQ(BOOST_PP_SEQ_ELEM(1, This)) //Encode / decode this #define BOOST_TYPEOF_TEMPLATE_PARAM_ENCODE(This, n)\ @@ -82,7 +82,7 @@ namespace boost BOOST_PP_ENUM_PARAMS(\ BOOST_PP_SEQ_SIZE(Params),\ P)> >\ - : BOOST_TYPEOF_PUSH_BACK >\ + : mpl::push_back >\ {\ };\ template struct decode_template_impl, Iter>\ diff --git a/include/boost/typeof/compliant/type_encoding.hpp b/include/boost/typeof/compliant/type_encoding.hpp index 60c930e..650081f 100755 --- a/include/boost/typeof/compliant/type_encoding.hpp +++ b/include/boost/typeof/compliant/type_encoding.hpp @@ -10,7 +10,7 @@ #define BOOST_TYPEOF_REGISTER_TYPE_IMPL(T, Id) \ \ template struct encode_type_impl \ - : BOOST_TYPEOF_PUSH_BACK > \ + : mpl::push_back > \ {}; \ template struct decode_type_impl, Iter> \ { \ diff --git a/include/boost/typeof/compliant/typeof_impl.hpp b/include/boost/typeof/compliant/typeof_impl.hpp index fe17fa2..24808c9 100755 --- a/include/boost/typeof/compliant/typeof_impl.hpp +++ b/include/boost/typeof/compliant/typeof_impl.hpp @@ -6,34 +6,34 @@ #define BOOST_TYPEOF_COMPLIANT_TYPEOF_IMPL_HPP_INCLUDED #include -#include -#include -#include -#include -#include #include - -#define BOOST_TYPEOF_PUSH_BACK detail::push_back -//#define BOOST_TYPEOF_PUSH_BACK mpl::push_back - -#include #include -namespace boost -{ - namespace type_of - { - template - char(&at(const T&))[ - mpl::at, T>::type, mpl::size_t >::type::value - ]; +#ifdef BOOST_TYPEOF_USE_MPL_VECTOR +# include +# include +# include +# include +# include +# include +# define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::mpl::vector, n) +#else +# include +# define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::type_of::vector, n) +#endif - template - char(&size(const T&))[ - mpl::size, T>::type>::value - ]; - } -} +namespace boost{namespace type_of{ + + template + char(&at(const T&))[ + mpl::at, T>::type, mpl::int_ >::type::value + ]; + + template + char(&size(const T&))[ + mpl::size, T>::type>::value + ]; +}} #define BOOST_TYPEOF_AT(n, expr) sizeof(boost::type_of::at(expr)) #define BOOST_TYPEOF_SIZE(expr) sizeof(boost::type_of::size(expr)) @@ -44,7 +44,7 @@ namespace boost #define BOOST_TYPEOF(Expr) \ boost::type_of::decode_type< \ boost::mpl::begin< \ - BOOST_PP_CAT(boost::mpl::vector, BOOST_TYPEOF_LIMIT_SIZE)< \ + BOOST_TYPEOF_VECTOR(BOOST_TYPEOF_LIMIT_SIZE)< \ BOOST_PP_ENUM(BOOST_TYPEOF_LIMIT_SIZE, BOOST_TYPEOF_TYPEITEM, Expr) \ > \ >::type \ @@ -53,7 +53,7 @@ namespace boost #define BOOST_TYPEOF_TPL(Expr) \ typename boost::type_of::decode_type< \ typename boost::mpl::begin< \ - BOOST_PP_CAT(boost::mpl::vector, BOOST_TYPEOF_LIMIT_SIZE)< \ + BOOST_TYPEOF_VECTOR(BOOST_TYPEOF_LIMIT_SIZE)< \ BOOST_PP_ENUM(BOOST_TYPEOF_LIMIT_SIZE, BOOST_TYPEOF_TYPEITEM, Expr) \ > \ >::type \ diff --git a/include/boost/typeof/compliant/vector.hpp b/include/boost/typeof/compliant/vector.hpp new file mode 100755 index 0000000..38959a0 --- /dev/null +++ b/include/boost/typeof/compliant/vector.hpp @@ -0,0 +1,151 @@ +// Copyright (C) 2005 Arkadiy Vertleyb +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +// Minimal replacement for mpl::vector<>. +// 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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_TYPEOF_LIMIT_SIZE +# define BOOST_TYPEOF_LIMIT_SIZE 50 +#endif + +// iterator + +namespace boost{namespace type_of{ + template + struct v_iter + { + typedef typename boost::mpl::at::type type; + typedef v_iter::type> next; + }; +}} + +// vector + +#define BOOST_TYPEOF_typedef_item(z, n, _)\ + typedef P ## n item ## n; + +#define BOOST_TYPEOF_define_vector(z, n, _)\ + template\ + struct vector ## n\ + {\ + typedef v_tag tag;\ + typedef v_iter > begin;\ + typedef mpl::int_ size;\ + BOOST_PP_REPEAT(n, BOOST_TYPEOF_typedef_item, ~)\ + }; + +namespace boost{namespace type_of{ + class v_tag; + BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_TYPEOF_LIMIT_SIZE), BOOST_TYPEOF_define_vector, ~) +}} + +#undef BOOST_TYPEOF_typedef_item +#undef BOOST_TYPEOF_define_vector + +// at (specializing at rather than at_impl gives some performance gain) + +#define BOOST_TYPEOF_spec_at(z, n, _)\ + template\ + struct at >\ + {\ + typedef typename V::item ## n type;\ + }; + +namespace boost{namespace mpl{ + BOOST_PP_REPEAT(BOOST_TYPEOF_LIMIT_SIZE, BOOST_TYPEOF_spec_at, ~) +}} + +/* +#define BOOST_TYPEOF_spec_at(z, n, _)\ + template\ + struct apply >\ + {\ + typedef typename V::item ## n type;\ + }; + +namespace boost{namespace mpl{ + template<> + struct at_impl + { + template + struct apply; + BOOST_PP_REPEAT(BOOST_TYPEOF_LIMIT_SIZE, BOOST_TYPEOF_spec_at, ~) + }; +}} +*/ + +#undef BOOST_TYPEOF_spec_at + +// size + +namespace boost{namespace mpl{ + template<> + struct size_impl + { + template + struct apply + { + typedef typename V::size type; + }; + }; +}} + +// push_back (specializing push_back rather than push_back_impl gives some performance gain) + +#define BOOST_TYPEOF_spec_push_back(z, n, _)\ + template\ + struct push_back, T>\ + {\ + typedef BOOST_PP_CAT(boost::type_of::vector, BOOST_PP_INC(n))<\ + BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_COMMA_IF(n) T\ + > type;\ + }; + +namespace boost{namespace mpl{ + BOOST_PP_REPEAT(BOOST_TYPEOF_LIMIT_SIZE, BOOST_TYPEOF_spec_push_back, ~) +}} + +/* +#define BOOST_TYPEOF_spec_push_back(z, n, _)\ + template\ + struct apply, T>\ + {\ + typedef BOOST_PP_CAT(boost::type_of::vector, BOOST_PP_INC(n))<\ + BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_COMMA_IF(n) T\ + > type;\ + }; + +namespace boost{namespace mpl{ + template<> + struct push_back_impl + { + template + struct apply; + BOOST_PP_REPEAT(BOOST_TYPEOF_LIMIT_SIZE, BOOST_TYPEOF_spec_push_back, ~) + }; +}} +*/ + +#undef BOOST_TYPEOF_spec_push_back + +#endif//BOOST_TYPEOF_COMPLIANT_VECTOR_HPP_INCLUDED + + + diff --git a/include/boost/typeof/message.hpp b/include/boost/typeof/message.hpp new file mode 100755 index 0000000..1471ef3 --- /dev/null +++ b/include/boost/typeof/message.hpp @@ -0,0 +1,8 @@ +// Copyright (C) 2005 Arkadiy Vertleyb +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#if defined(_MSC_VER) && !defined BOOST_TYPEOF_SILENT +# pragma message(BOOST_TYPEOF_TEXT) +#endif +#undef BOOST_TYPEOF_TEXT diff --git a/include/boost/typeof/typeof.hpp b/include/boost/typeof/typeof.hpp index 444fb1a..b00fe39 100755 --- a/include/boost/typeof/typeof.hpp +++ b/include/boost/typeof/typeof.hpp @@ -16,11 +16,13 @@ // BOOST_TYPEOF, BOOST_TYPEOF_TPL #if defined(BOOST_TYPEOF_COMPLIANT) -# pragma message("using compliant imlementation") +# define BOOST_TYPEOF_TEXT "using compliant imlementation" +# include # include #elif defined(BOOST_TYPEOF_VINTAGE) -# pragma message("using vintage imlementation") +# define BOOST_TYPEOF_TEXT "using vintage imlementation" +# include # include #else//BOOST_TYPEOF_NATIVE diff --git a/test/boost-build.jam b/test/boost-build.jam new file mode 100755 index 0000000..ba29fcd --- /dev/null +++ b/test/boost-build.jam @@ -0,0 +1 @@ +boost-build c:$(SLASH)boost$(SLASH)boost_1_32_0$(SLASH)tools$(SLASH)build$(SLASH)v1 ; \ No newline at end of file diff --git a/test/compliant/odr1.cpp b/test/compliant/odr1.cpp index 82eece3..3381c27 100755 --- a/test/compliant/odr1.cpp +++ b/test/compliant/odr1.cpp @@ -2,6 +2,9 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) +#include +#ifndef BOOST_TYPEOF_VINTAGE + #include #include "odr.hpp" @@ -16,3 +19,5 @@ void odr_test1() cout << make_sum(d, i)() << endl; cout << make_sum(i, d)() << endl; } + +#endif//BOOST_TYPEOF_VINTAGE diff --git a/test/compliant/odr2.cpp b/test/compliant/odr2.cpp index 31b4bdd..00cef8d 100755 --- a/test/compliant/odr2.cpp +++ b/test/compliant/odr2.cpp @@ -2,6 +2,9 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) +#include +#ifndef BOOST_TYPEOF_VINTAGE + #include #include "odr.hpp" @@ -16,3 +19,5 @@ void odr_test2() cout << make_sum(d, i)() << endl; cout << make_sum(i, d)() << endl; } + +#endif //BOOST_TYPEOF_VINTAGE diff --git a/test/compliant/test_compliant.cpp b/test/compliant/test_compliant.cpp index 925c4c6..d331e29 100755 --- a/test/compliant/test_compliant.cpp +++ b/test/compliant/test_compliant.cpp @@ -1,14 +1,24 @@ -#pragma warning(disable:4512) +// Copyright (C) 2005 Arkadiy Vertleyb +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#include +#ifndef BOOST_TYPEOF_VINTAGE + +#ifdef _MSC_VER +# pragma warning(disable:4512) +#endif #include - #include "spirit/register.hpp" #include "lambda/register.hpp" #include #include #include -#pragma message("compiling Lambda example...") +#define BOOST_TYPEOF_TEXT "compiling Lambda example..." +#include + void test_lambda() { using namespace boost::lambda; @@ -22,7 +32,9 @@ void test_lambda() std::cout << typeid(fun).name() << std::endl; } -#pragma message("compiling Spirit example...") +#define BOOST_TYPEOF_TEXT "compiling Spirit example..." +#include + void test_spirit1() { using namespace boost::spirit; @@ -41,7 +53,9 @@ void test_spirit1() cout << endl; } -#pragma message("compiling another Spirit example...") +#define BOOST_TYPEOF_TEXT "compiling another Spirit example..." +#include + void test_spirit2() { using namespace boost::spirit; @@ -61,4 +75,21 @@ void test_spirit2() if (!success) throw 0; } -#pragma message("done!") + +#define BOOST_TYPEOF_TEXT "negate test" +#include + +#include +namespace negate_test +{ + template T make(); + + template + BOOST_TYPEOF_TPL(make >()(T())) + operator-(T const& x) + { + return std::negate()(x); + } +} + +#endif//BOOST_TYPEOF_VINTAGE diff --git a/test/compliant/typeof.sln b/test/compliant/typeof.sln index 25b339b..fe3d1b4 100755 --- a/test/compliant/typeof.sln +++ b/test/compliant/typeof.sln @@ -6,13 +6,19 @@ EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug + Debug_MPL_vector = Debug_MPL_vector Release = Release + Release_MPL_vector = Release_MPL_vector EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {5C140C9B-1EF9-483D-92CB-86A1108AA7BF}.Debug.ActiveCfg = Debug|Win32 {5C140C9B-1EF9-483D-92CB-86A1108AA7BF}.Debug.Build.0 = Debug|Win32 + {5C140C9B-1EF9-483D-92CB-86A1108AA7BF}.Debug_MPL_vector.ActiveCfg = Debug_MPL_vector|Win32 + {5C140C9B-1EF9-483D-92CB-86A1108AA7BF}.Debug_MPL_vector.Build.0 = Debug_MPL_vector|Win32 {5C140C9B-1EF9-483D-92CB-86A1108AA7BF}.Release.ActiveCfg = Release|Win32 {5C140C9B-1EF9-483D-92CB-86A1108AA7BF}.Release.Build.0 = Release|Win32 + {5C140C9B-1EF9-483D-92CB-86A1108AA7BF}.Release_MPL_vector.ActiveCfg = Release_MPL_vector|Win32 + {5C140C9B-1EF9-483D-92CB-86A1108AA7BF}.Release_MPL_vector.Build.0 = Release_MPL_vector|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection diff --git a/test/compliant/typeof.vcproj b/test/compliant/typeof.vcproj index 54386e2..673208c 100755 --- a/test/compliant/typeof.vcproj +++ b/test/compliant/typeof.vcproj @@ -109,6 +109,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -120,6 +219,9 @@ + + @@ -206,6 +308,9 @@ + + C:/boost/boost_1_32_0 + ../../.. + BOOST_TYPEOF_COMPLIANT + BOOST_TYPEOF_COMPLIANT +# <*><*>BOOST_TYPEOF_SILENT +; diff --git a/test/jamrules b/test/jamrules new file mode 100755 index 0000000..e69de29 diff --git a/test/main.cpp b/test/main.cpp index 3dd8414..5b9d411 100755 --- a/test/main.cpp +++ b/test/main.cpp @@ -2,9 +2,13 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#pragma message("including typeof.hpp...") +#define BOOST_TYPEOF_TEXT "including typeof.hpp..." +#include + #include -#pragma message("done") + +#define BOOST_TYPEOF_TEXT "done" +#include #include #include @@ -55,7 +59,9 @@ struct typeof_test }; #ifdef BOOST_TYPEOF_COMPLIANT -#pragma message("template template encoding...") + +#define BOOST_TYPEOF_TEXT "template template encoding..." +#include namespace template_template { template class P0,int P1> @@ -63,8 +69,13 @@ namespace template_template { template struct C {}; + + template class T> + struct A; } +BOOST_TYPEOF_REGISTER_TEMPLATE(template_template::A, (BOOST_TYPEOF_TEMPLATE(2))) + BOOST_TYPEOF_REGISTER_TEMPLATE(template_template::tt_test, (BOOST_TYPEOF_TEMPLATE((typename)(unsigned int))) (int) @@ -76,9 +87,12 @@ BOOST_TYPEOF_REGISTER_TEMPLATE(template_template::C, ) BOOST_STATIC_ASSERT((typeof_test >::value)); + + #endif -#pragma message("modifiers...") +#define BOOST_TYPEOF_TEXT "modifiers..." +#include BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); @@ -96,8 +110,6 @@ BOOST_STATIC_ASSERT((typeof_test >::value)); BOOST_STATIC_ASSERT((typeof_test >::value)); -#pragma message("started") - struct x {}; @@ -119,11 +131,15 @@ BOOST_TYPEOF_REGISTER_TEMPLATE(with_integrals, (unsigned) ) -#pragma message("integral...") +#define BOOST_TYPEOF_TEXT "integral..." +#include + BOOST_STATIC_ASSERT((typeof_test >::value)); BOOST_STATIC_ASSERT((typeof_test >::value)); -#pragma message("namespace-level function pointers...") +#define BOOST_TYPEOF_TEXT "namespace-level function pointers..." +#include + BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); @@ -131,18 +147,26 @@ BOOST_STATIC_ASSERT(typeof_test::value); - BOOST_STATIC_ASSERT(typeof_test::value); + +# define BOOST_TYPEOF_TEXT "function references..." +# include + + BOOST_STATIC_ASSERT(typeof_test::value); + BOOST_STATIC_ASSERT(typeof_test::value); #endif//BOOST_TYPEOF_COMPLIANT #ifdef BOOST_TYPEOF_COMPLIANT -# pragma message("function values...") + +# define BOOST_TYPEOF_TEXT "function values..." +# include + BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); #endif//BOOST_TYPEOF_COMPLIANT -#pragma message("member functions...") +#define BOOST_TYPEOF_TEXT "member functions..." +#include + BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); @@ -151,10 +175,14 @@ BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); -#pragma message("data members...") +#define BOOST_TYPEOF_TEXT "data members..." +#include + BOOST_STATIC_ASSERT(typeof_test::value); -#pragma message("Lvalue test...") +#define BOOST_TYPEOF_TEXT "Lvalue test..." +#include + void lvalue_typeof_test() { int n; @@ -178,7 +206,8 @@ void lvalue_typeof_test() //BOOST_STATIC_ASSERT((boost::is_same::value)); } -#pragma message("Noncopyable...") +#define BOOST_TYPEOF_TEXT "Noncopyable..." +#include BOOST_TYPEOF_REGISTER_TYPE(boost::noncopyable) @@ -193,7 +222,8 @@ struct noncopiable_test } }; -#pragma message("STL containers...") +#define BOOST_TYPEOF_TEXT "STL containers..." +#include BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test >::value); @@ -207,7 +237,8 @@ BOOST_STATIC_ASSERT(typeof_test >::value); BOOST_STATIC_ASSERT(typeof_test >::value); BOOST_STATIC_ASSERT(typeof_test >::value); -#pragma message("function objects...") +#define BOOST_TYPEOF_TEXT "function objects..." +#include BOOST_STATIC_ASSERT((typeof_test >::value)); BOOST_STATIC_ASSERT((typeof_test >::value)); @@ -231,11 +262,13 @@ BOOST_STATIC_ASSERT(typeof_test > >::value); BOOST_STATIC_ASSERT(typeof_test > >::value); BOOST_STATIC_ASSERT(typeof_test > >::value); -#pragma message("valarray...") +#define BOOST_TYPEOF_TEXT "valarray..." +#include BOOST_STATIC_ASSERT(typeof_test >::value); -#pragma message("compiling integral param wrapper...") +#define BOOST_TYPEOF_TEXT "compiling integral param wrapper..." +#include namespace test_integral { @@ -281,26 +314,35 @@ namespace test_integral BOOST_AUTO(yy, xx); BOOST_AUTO(yyy, xxx); - y; - yy; - yyy; + y = y; + yy = yy; + yyy = yyy; } } -#pragma message("ODR...") +#define BOOST_TYPEOF_TEXT "ODR..." +#include + void odr_test() { +#ifndef BOOST_TYPEOF_VINTAGE + void odr_test1(); void odr_test2(); odr_test1(); odr_test2(); + +#endif//BOOST_TYPEOF_VINTAGE } -#pragma message("main()...") +#define BOOST_TYPEOF_TEXT "main()..." +#include + int main() { odr_test(); return 0; } -#pragma message("done!") +#define BOOST_TYPEOF_TEXT "done!" +#include