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]
This commit is contained in:
Arkadiy Vertleyb
2005-03-20 13:18:15 +00:00
parent 5146154418
commit 8263416816
21 changed files with 470 additions and 130 deletions

View File

@ -5,13 +5,7 @@
#ifndef BOOST_TYPEOF_CONCATENATE_HPP_INCLUDED
#define BOOST_TYPEOF_CONCATENATE_HPP_INCLUDED
#include <boost/mpl/vector.hpp>
#include <boost/mpl/size_t.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
// 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<V, mpl::size_t<ID> >::type \
#define BOOST_TYPEOF_ENCODE_PARAMS(n, ID) \
BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_BEGIN, ~) \
typename mpl::push_back<V, mpl::size_t<ID> >::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<class T BOOST_PP_ENUM_TRAILING_PARAMS(i, class T)> \
struct push_back<BOOST_PP_CAT(mpl::vector, i)<BOOST_PP_ENUM_PARAMS(i, T)>, 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<class V, class T> 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

View File

@ -5,30 +5,30 @@
#ifndef BOOST_TYPEOF_ENCODE_DECODE_HPP_INCLUDED
#define BOOST_TYPEOF_ENCODE_DECODE_HPP_INCLUDED
namespace boost
{
namespace type_of
#include <boost/mpl/deref.hpp>
#include <boost/mpl/next.hpp>
namespace boost{namespace type_of{namespace{
template<class V, class Type_Not_Registered_With_Typeof_System>
struct encode_type_impl;
template<class T, class Iter>
struct decode_type_impl
{
namespace
{
template<class V, class Type_Not_Registered_With_Typeof_System>
struct encode_type_impl;
template<class T, class Iter>
struct decode_type_impl;
}
typedef int type; // MSVC ETI workaround
};
template<class V, class T>
struct encode_type : encode_type_impl<V, T>
{};
template<class V, class T>
struct encode_type : encode_type_impl<V, T>
{};
template<class Iter>
struct decode_type : decode_type_impl<
typename mpl::deref<Iter>::type,
typename mpl::next<Iter>::type
>
{};
}
}
template<class Iter>
struct decode_type : decode_type_impl<
typename mpl::deref<Iter>::type,
typename mpl::next<Iter>::type
>
{};
}}}
#endif//BOOST_TYPEOF_ENCODE_DECODE_HPP_INCLUDED

View File

@ -6,7 +6,6 @@
#define BOOST_TYPEOF_INT_ENCODING_HPP_INCLUDED
#include <boost/mpl/if.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/size_t.hpp>
namespace boost{namespace type_of{
@ -54,14 +53,14 @@ namespace boost{namespace type_of{
////////////////////////////////
template<class V, size_t n, bool overflow = (n >= 0x3fffffff)>
struct encode_size_t : BOOST_TYPEOF_PUSH_BACK<
struct encode_size_t : mpl::push_back<
V,
boost::mpl::size_t<pack<n, false>::value>
>
{};
template<class V, size_t n>
struct encode_size_t<V, n, true> : BOOST_TYPEOF_PUSH_BACK<typename BOOST_TYPEOF_PUSH_BACK<
struct encode_size_t<V, n, true> : mpl::push_back<typename mpl::push_back<
V,
boost::mpl::size_t<pack<n % 0x3ffffffe, true>::value> >::type,
boost::mpl::size_t<n / 0x3ffffffe>

View File

@ -17,7 +17,7 @@
{\
typedef\
typename encode_type<\
typename BOOST_TYPEOF_PUSH_BACK<\
typename mpl::push_back<\
V\
, mpl::size_t<ID> >::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<ID> >::type\
, mpl::size_t<N> >::type\

View File

@ -57,7 +57,7 @@
>\
struct encode_type_impl<V, Name<BOOST_PP_ENUM_PARAMS(Size, P)> >\
{\
typedef typename BOOST_TYPEOF_PUSH_BACK<V, boost::mpl::size_t<ID> >::type V0;\
typedef typename mpl::push_back<V, boost::mpl::size_t<ID> >::type V0;\
BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM, ~, Params)\
typedef BOOST_PP_CAT(V, Size) type;\
};\

View File

@ -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<V, mpl::size_t<ID> >\
: mpl::push_back<V, mpl::size_t<ID> >\
{\
};\
template<class Iter> struct decode_template_impl<mpl::size_t<ID>, Iter>\

View File

@ -10,7 +10,7 @@
#define BOOST_TYPEOF_REGISTER_TYPE_IMPL(T, Id) \
\
template<class V> struct encode_type_impl<V, T > \
: BOOST_TYPEOF_PUSH_BACK<V, mpl::size_t<Id> > \
: mpl::push_back<V, mpl::size_t<Id> > \
{}; \
template<class Iter> struct decode_type_impl<mpl::size_t<Id>, Iter> \
{ \

View File

@ -6,34 +6,34 @@
#define BOOST_TYPEOF_COMPLIANT_TYPEOF_IMPL_HPP_INCLUDED
#include <boost/mpl/size_t.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#define BOOST_TYPEOF_PUSH_BACK detail::push_back
//#define BOOST_TYPEOF_PUSH_BACK mpl::push_back
#include <boost/typeof/compliant/limit_size.hpp>
#include <boost/typeof/compliant/encode_decode.hpp>
namespace boost
{
namespace type_of
{
template<int pos, class T>
char(&at(const T&))[
mpl::at<typename encode_type<mpl::vector0<>, T>::type, mpl::size_t<pos> >::type::value
];
#ifdef BOOST_TYPEOF_USE_MPL_VECTOR
# include <boost/mpl/vector.hpp>
# include <boost/mpl/size.hpp>
# include <boost/mpl/at.hpp>
# include <boost/mpl/begin_end.hpp>
# include <boost/mpl/push_back.hpp>
# include <boost/typeof/compliant/limit_size.hpp>
# define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::mpl::vector, n)
#else
# include <boost/typeof/compliant/vector.hpp>
# define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::type_of::vector, n)
#endif
template<class T>
char(&size(const T&))[
mpl::size<typename encode_type<mpl::vector0<>, T>::type>::value
];
}
}
namespace boost{namespace type_of{
template<int pos, class T>
char(&at(const T&))[
mpl::at<typename encode_type<BOOST_TYPEOF_VECTOR(0)<>, T>::type, mpl::int_<pos> >::type::value
];
template<class T>
char(&size(const T&))[
mpl::size<typename encode_type<BOOST_TYPEOF_VECTOR(0)<>, T>::type>::value
];
}}
#define BOOST_TYPEOF_AT(n, expr) sizeof(boost::type_of::at<n>(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 \

View File

@ -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 <boost/mpl/at.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/int.hpp>
#include <boost/preprocessor/enum_params.hpp>
#include <boost/preprocessor/repeat.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/inc.hpp>
#include <boost/preprocessor/comma_if.hpp>
#ifndef BOOST_TYPEOF_LIMIT_SIZE
# define BOOST_TYPEOF_LIMIT_SIZE 50
#endif
// iterator
namespace boost{namespace type_of{
template<class V, class Pos>
struct v_iter
{
typedef typename boost::mpl::at<V, Pos>::type type;
typedef v_iter<V, typename boost::mpl::next<Pos>::type> next;
};
}}
// vector
#define BOOST_TYPEOF_typedef_item(z, n, _)\
typedef P ## n item ## n;
#define BOOST_TYPEOF_define_vector(z, n, _)\
template<BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_COMMA_IF(n) class T = void>\
struct vector ## n\
{\
typedef v_tag tag;\
typedef v_iter<vector ## n, boost::mpl::int_<0> > begin;\
typedef mpl::int_<n> 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<class V>\
struct at<V, int_<n> >\
{\
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<class V>\
struct apply<V, int_<n> >\
{\
typedef typename V::item ## n type;\
};
namespace boost{namespace mpl{
template<>
struct at_impl<boost::type_of::v_tag>
{
template<class V, class N>
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<boost::type_of::v_tag>
{
template<class V>
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<BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_COMMA_IF(n) class T>\
struct push_back<BOOST_PP_CAT(boost::type_of::vector, n)<BOOST_PP_ENUM_PARAMS(n, P)>, 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<BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_COMMA_IF(n) class T>\
struct apply<BOOST_PP_CAT(boost::type_of::vector, n)<BOOST_PP_ENUM_PARAMS(n, P)>, 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<boost::type_of::v_tag>
{
template<class V, class T>
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

View File

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

View File

@ -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 <boost/typeof/message.hpp>
# include <boost/typeof/compliant/typeof_impl.hpp>
#elif defined(BOOST_TYPEOF_VINTAGE)
# pragma message("using vintage imlementation")
# define BOOST_TYPEOF_TEXT "using vintage imlementation"
# include <boost/typeof/message.hpp>
# include <boost/typeof/vintage/typeof_impl.hpp>
#else//BOOST_TYPEOF_NATIVE

1
test/boost-build.jam Executable file
View File

@ -0,0 +1 @@
boost-build c:$(SLASH)boost$(SLASH)boost_1_32_0$(SLASH)tools$(SLASH)build$(SLASH)v1 ;

View File

@ -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 <boost/typeof/config.hpp>
#ifndef BOOST_TYPEOF_VINTAGE
#include <iostream>
#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

View File

@ -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 <boost/typeof/config.hpp>
#ifndef BOOST_TYPEOF_VINTAGE
#include <iostream>
#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

View File

@ -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 <boost/typeof/config.hpp>
#ifndef BOOST_TYPEOF_VINTAGE
#ifdef _MSC_VER
# pragma warning(disable:4512)
#endif
#include <boost/typeof/typeof.hpp>
#include "spirit/register.hpp"
#include "lambda/register.hpp"
#include <libs/typeof/test/stl/register.hpp>
#include <cassert>
#include <iostream>
#pragma message("compiling Lambda example...")
#define BOOST_TYPEOF_TEXT "compiling Lambda example..."
#include <boost/typeof/message.hpp>
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 <boost/typeof/message.hpp>
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 <boost/typeof/message.hpp>
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 <boost/typeof/message.hpp>
#include <functional>
namespace negate_test
{
template<class T> T make();
template <class T>
BOOST_TYPEOF_TPL(make<std::negate<T> >()(T()))
operator-(T const& x)
{
return std::negate<T>()(x);
}
}
#endif//BOOST_TYPEOF_VINTAGE

View File

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

View File

@ -109,6 +109,105 @@
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug_MPL_vector|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="C:\boost\boost_1_32_0;..\..\..\.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_TYPEOF_USE_MPL_VECTOR"
GeneratePreprocessedFile="0"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/typeof.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/typeof.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release_MPL_vector|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="C:\boost\boost_1_32_0;..\..\..\.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_TYPEOF_USE_MPL_VECTOR"
GeneratePreprocessedFile="0"
RuntimeLibrary="4"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/typeof.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
@ -120,6 +219,9 @@
<File
RelativePath="..\main.cpp">
</File>
<File
RelativePath="..\..\..\..\boost\typeof\message.hpp">
</File>
<File
RelativePath=".\odr1.cpp">
</File>
@ -206,6 +308,9 @@
<File
RelativePath="..\..\..\..\boost\typeof\compliant\typeof_impl.hpp">
</File>
<File
RelativePath="..\..\..\..\boost\typeof\compliant\vector.hpp">
</File>
</Filter>
</Filter>
<Filter

View File

@ -1,9 +1,9 @@
time /T
g++ -IC:\boost\boost_1_32_0 -I..\..\..\.. -D BOOST_TYPEOF_COMPLIANT -D BOOST_TYPEOF_LIMIT_SIZE=50 -D BOOST_MPL_LIMIT_VECTOR_SIZE=50 ..\main.cpp test_compliant.cpp odr1.cpp odr2.cpp
g++ -I C:\boost\boost_1_32_0 -I ..\..\..\.. ..\main.cpp test_compliant.cpp odr1.cpp odr2.cpp
time /T
g++ -IC:\boost\boost_1_32_0 -I..\..\..\.. ..\main.cpp test_compliant.cpp odr1.cpp odr2.cpp
g++ -I C:\boost\boost_1_32_0 -I ..\..\..\.. -D BOOST_TYPEOF_COMPLIANT ..\main.cpp test_compliant.cpp odr1.cpp odr2.cpp
time /T

18
test/jamfile Executable file
View File

@ -0,0 +1,18 @@
project-root ;
variant debug_native : debug ;
variant release_native : release ;
exe typeof
:
main.cpp
compliant/test_compliant.cpp
compliant/odr1.cpp
compliant/odr2.cpp
:
<include>C:/boost/boost_1_32_0
<include>../../..
<gcc><debug><define>BOOST_TYPEOF_COMPLIANT
<gcc><release><define>BOOST_TYPEOF_COMPLIANT
# <*><*><define>BOOST_TYPEOF_SILENT
;

0
test/jamrules Executable file
View File

View File

@ -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 <boost/typeof/message.hpp>
#include <boost/typeof/typeof.hpp>
#pragma message("done")
#define BOOST_TYPEOF_TEXT "done"
#include <boost/typeof/message.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/type_traits/is_same.hpp>
@ -55,7 +59,9 @@ struct typeof_test
};
#ifdef BOOST_TYPEOF_COMPLIANT
#pragma message("template template encoding...")
#define BOOST_TYPEOF_TEXT "template template encoding..."
#include <boost/typeof/message.hpp>
namespace template_template {
template<template<typename,unsigned int> class P0,int P1>
@ -63,8 +69,13 @@ namespace template_template {
template<typename A,unsigned int B>
struct C {};
template<template<class, class> 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<template_template::tt_test<template_template::C,4> >::value));
#endif
#pragma message("modifiers...")
#define BOOST_TYPEOF_TEXT "modifiers..."
#include <boost/typeof/message.hpp>
BOOST_STATIC_ASSERT(typeof_test<int*>::value);
BOOST_STATIC_ASSERT(typeof_test<int&>::value);
@ -96,8 +110,6 @@ BOOST_STATIC_ASSERT((typeof_test<boost::mpl::vector2<const int* const, const int
BOOST_STATIC_ASSERT((typeof_test<boost::mpl::vector1<int[5]> >::value));
BOOST_STATIC_ASSERT((typeof_test<boost::mpl::vector1<const int[5]> >::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/typeof/message.hpp>
BOOST_STATIC_ASSERT((typeof_test<with_integrals<int, 5, 4, -3, 2, true, false, -1, 5> >::value));
BOOST_STATIC_ASSERT((typeof_test<with_integrals<int, 1, 1, 0, ULONG_MAX, false, true, -1, 0> >::value));
#pragma message("namespace-level function pointers...")
#define BOOST_TYPEOF_TEXT "namespace-level function pointers..."
#include <boost/typeof/message.hpp>
BOOST_STATIC_ASSERT(typeof_test<double(*)()>::value);
BOOST_STATIC_ASSERT(typeof_test<double(*)(int, double, short, char*, bool, char, float, long, unsigned short)>::value);
BOOST_STATIC_ASSERT(typeof_test<void(*)()>::value);
@ -131,18 +147,26 @@ BOOST_STATIC_ASSERT(typeof_test<void(*)(int, double, short, char*, bool, char, f
#ifdef BOOST_TYPEOF_COMPLIANT
# pragma message("function references...")
BOOST_STATIC_ASSERT(typeof_test<void(&)()>::value);
BOOST_STATIC_ASSERT(typeof_test<int(&)(int, short)>::value);
# define BOOST_TYPEOF_TEXT "function references..."
# include <boost/typeof/message.hpp>
BOOST_STATIC_ASSERT(typeof_test<void(&)()>::value);
BOOST_STATIC_ASSERT(typeof_test<int(&)(int, short)>::value);
#endif//BOOST_TYPEOF_COMPLIANT
#ifdef BOOST_TYPEOF_COMPLIANT
# pragma message("function values...")
# define BOOST_TYPEOF_TEXT "function values..."
# include <boost/typeof/message.hpp>
BOOST_STATIC_ASSERT(typeof_test<void()>::value);
BOOST_STATIC_ASSERT(typeof_test<double(bool)>::value);
#endif//BOOST_TYPEOF_COMPLIANT
#pragma message("member functions...")
#define BOOST_TYPEOF_TEXT "member functions..."
#include <boost/typeof/message.hpp>
BOOST_STATIC_ASSERT(typeof_test<double(x::*)()>::value);
BOOST_STATIC_ASSERT(typeof_test<double(x::*)(int, double, short, char*, bool, char, float, long, unsigned short)>::value);
BOOST_STATIC_ASSERT(typeof_test<void(x::*)()>::value);
@ -151,10 +175,14 @@ BOOST_STATIC_ASSERT(typeof_test<double(x::*)()const>::value);
BOOST_STATIC_ASSERT(typeof_test<double(x::*)()volatile>::value);
BOOST_STATIC_ASSERT(typeof_test<double(x::*)()volatile const>::value);
#pragma message("data members...")
#define BOOST_TYPEOF_TEXT "data members..."
#include <boost/typeof/message.hpp>
BOOST_STATIC_ASSERT(typeof_test<double x::*>::value);
#pragma message("Lvalue test...")
#define BOOST_TYPEOF_TEXT "Lvalue test..."
#include <boost/typeof/message.hpp>
void lvalue_typeof_test()
{
int n;
@ -178,7 +206,8 @@ void lvalue_typeof_test()
//BOOST_STATIC_ASSERT((boost::is_same<BOOST_LVALUE_TYPEOF(int(21)), int>::value));
}
#pragma message("Noncopyable...")
#define BOOST_TYPEOF_TEXT "Noncopyable..."
#include <boost/typeof/message.hpp>
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/typeof/message.hpp>
BOOST_STATIC_ASSERT(typeof_test<string>::value);
BOOST_STATIC_ASSERT(typeof_test<deque<int> >::value);
@ -207,7 +237,8 @@ BOOST_STATIC_ASSERT(typeof_test<set<int> >::value);
BOOST_STATIC_ASSERT(typeof_test<multiset<int> >::value);
BOOST_STATIC_ASSERT(typeof_test<bitset<10> >::value);
#pragma message("function objects...")
#define BOOST_TYPEOF_TEXT "function objects..."
#include <boost/typeof/message.hpp>
BOOST_STATIC_ASSERT((typeof_test<unary_function<int, int> >::value));
BOOST_STATIC_ASSERT((typeof_test<binary_function<int, int, int> >::value));
@ -231,11 +262,13 @@ BOOST_STATIC_ASSERT(typeof_test<binary_negate<less<int> > >::value);
BOOST_STATIC_ASSERT(typeof_test<binder1st<less<int> > >::value);
BOOST_STATIC_ASSERT(typeof_test<binder2nd<less<int> > >::value);
#pragma message("valarray...")
#define BOOST_TYPEOF_TEXT "valarray..."
#include <boost/typeof/message.hpp>
BOOST_STATIC_ASSERT(typeof_test<valarray<int> >::value);
#pragma message("compiling integral param wrapper...")
#define BOOST_TYPEOF_TEXT "compiling integral param wrapper..."
#include <boost/typeof/message.hpp>
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 <boost/typeof/message.hpp>
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 <boost/typeof/message.hpp>
int main()
{
odr_test();
return 0;
}
#pragma message("done!")
#define BOOST_TYPEOF_TEXT "done!"
#include <boost/typeof/message.hpp>