stl registration

[SVN r2426]
This commit is contained in:
Arkadiy Vertleyb
2005-01-03 02:54:20 +00:00
parent c01859dcc4
commit 092974614f
23 changed files with 807 additions and 30 deletions

21
genreg/genreg.sln Executable file
View File

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genreg", "genreg.vcproj", "{FA64812A-E4D6-4629-A479-4D4708FB7520}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{FA64812A-E4D6-4629-A479-4D4708FB7520}.Debug.ActiveCfg = Debug|Win32
{FA64812A-E4D6-4629-A479-4D4708FB7520}.Debug.Build.0 = Debug|Win32
{FA64812A-E4D6-4629-A479-4D4708FB7520}.Release.ActiveCfg = Release|Win32
{FA64812A-E4D6-4629-A479-4D4708FB7520}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

137
genreg/genreg.vcproj Executable file
View File

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="genreg"
ProjectGUID="{FA64812A-E4D6-4629-A479-4D4708FB7520}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="."
IntermediateDirectory="."
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/genreg.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/genreg.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|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="4"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/genreg.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>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\main.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="C:\boost\boost_1_32_0"
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
</Filter>
<File
RelativePath=".\input.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

100
genreg/input.txt Executable file
View File

@ -0,0 +1,100 @@
~string
#memory
TEMPLATE,std::char_traits,1
TEMPLATE,std::basic_string,1,3
~deque
#memory
TEMPLATE,std::deque,1,2
~list
#memory
TEMPLATE,std::list,1,2
~queue
#memory
TEMPLATE,std::queue,1,2
~stack
#memory
TEMPLATE,std::stack,1,2
~vector
#memory
TEMPLATE,std::vector,1,2
~map
#memory
#functional
#utility
TEMPLATE,std::map,2,4
TEMPLATE,std::multimap,2,4
~set
#memory
#functional
TEMPLATE,std::set,1,3
TEMPLATE,std::multiset,1,3
~bitset
TEMPLATE_X,std::bitset,(size_t)
~utility
TEMPLATE,std::pair,2
~functional
TEMPLATE,std::unary_function,2
TEMPLATE,std::binary_function,3
TEMPLATE,std::plus,1
TEMPLATE,std::minus,1
TEMPLATE,std::multiplies,1
TEMPLATE,std::divides,1
TEMPLATE,std::modulus,1
TEMPLATE,std::negate,1
TEMPLATE,std::equal_to,1
TEMPLATE,std::not_equal_to,1
TEMPLATE,std::greater,1
TEMPLATE,std::less,1
TEMPLATE,std::greater_equal,1
TEMPLATE,std::less_equal,1
TEMPLATE,std::logical_and,1
TEMPLATE,std::logical_or,1
TEMPLATE,std::logical_not,1
TEMPLATE,std::unary_negate,1
TEMPLATE,std::binary_negate,1
TEMPLATE,std::binder1st,1
TEMPLATE,std::binder2nd,1
TEMPLATE,std::pointer_to_unary_function,2
TEMPLATE,std::pointer_to_binary_function,3
TEMPLATE,std::mem_fun_t,2
TEMPLATE,std::mem_fun1_t,3
TEMPLATE,std::mem_fun_ref_t,2
TEMPLATE,std::mem_fun1_ref_t,3
TEMPLATE,std::const_mem_fun_t,2
TEMPLATE,std::const_mem_fun1_t,3
TEMPLATE,std::const_mem_fun_ref_t,2
TEMPLATE,std::const_mem_fun1_ref_t,3
~memory
TEMPLATE,std::allocator,1
TEMPLATE,std::raw_storage_iterator,2
TEMPLATE,std::auto_ptr,1

172
genreg/main.cpp Executable file
View File

@ -0,0 +1,172 @@
#include <boost/shared_ptr.hpp>
#include <fstream>
#include <iostream>
#include <string>
#include <boost/tokenizer.hpp>
#include <boost/lexical_cast.hpp>
using namespace std;
using namespace boost;
template<class T, class Tokenizer>
T getTokenAt(const Tokenizer& tokens, size_t pos)
{
typename Tokenizer::iterator it = tokens.begin();
for (size_t i = 0; i < pos; ++i)
{
if (++it == tokens.end())
break;
}
if (it == tokens.end())
throw runtime_error("line parsing error -- not enough tokens");
return lexical_cast<T>(*it);
}
string name2path(const string& name, const string& ext)
{
return string("../../../boost/typeof/std/") + name + "." + ext;
}
string copyright(const string& master)
{
return
"// Copyright (C) 2004 " + master + ".\n"
"// Use, modification and distribution is subject to the Boost Software\n"
"// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)\n\n"
"// This is a generated file -- please do not modify."
;
}
class ofile
{
public:
ofile(const string& name, const string& ext)
: m_out(name2path(name, ext).c_str())
, m_isnew(true)
{
if (!m_out.is_open())
throw runtime_error(name2path(name, ext) + " -- can't create");
m_guard = "BOOST_TYPEOF_STD_" + name + "_" + ext + "_INCLUDED";
m_out << copyright("Arkadiy Vertleyb, Peder Holt") << endl;
m_out << endl;
m_out << "#ifndef " << m_guard << endl;
m_out << "#define " << m_guard << endl;
m_out << endl;
}
~ofile()
{
m_out << endl;
m_out << "#endif//" << m_guard << endl;
}
void operator()(const string& text)
{
if (m_isnew)
{
m_isnew = false;
m_out << endl << "#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()" << endl << endl;
}
tokenizer<escaped_list_separator<char> > tokens(text, escaped_list_separator<char>('\\', ',', '\"'));
string what = getTokenAt<string>(tokens, 0);
string name = getTokenAt<string>(tokens, 1);
if (what == "TEMPLATE")
{
int nMin = getTokenAt<int>(tokens, 2);
int nMax = nMin;
try
{
nMax = getTokenAt<int>(tokens, 3);
}
catch(const runtime_error&)
{}
for (int i = nMin; i <= nMax; ++i)
{
if (i == nMin && i != nMax)
m_out << "#ifdef BOOST_TYPEOF_COMPLIANT" << endl;
if (i == nMax && i != nMin)
m_out << "#endif//BOOST_TYPEOF_COMPLIANT" << endl;
m_out << "BOOST_TYPEOF_REGISTER_TEMPLATE(" << name << ", " << i << ")" << endl;
}
}
else if (what == "TYPE")
{
m_out << "BOOST_TYPEOF_REGISTER_TYPE(" << name << ")" << endl;
}
else if (what == "TEMPLATE_X")
{
string params = getTokenAt<string>(tokens, 2);
m_out << "BOOST_TYPEOF_REGISTER_TEMPLATE_X(" << name << ", " << params << ")" << endl;
}
else
{
throw runtime_error(string("Can't register ") + what);
}
}
void include(const string& path)
{
m_out << "#include <" << path << ">" << endl;
}
private:
ofstream m_out;
string m_guard;
bool m_isnew;
};
int main()
{
try
{
string text;
boost::shared_ptr<ofile> file_ptr;
ifstream in("input.txt");
while(getline(in, text))
{
if (text.empty())
{
continue;
}
else if (text[0] == '~')
{
string name = text.substr(1);
file_ptr.reset(new ofile(name, "hpp"));
file_ptr->include(name);
file_ptr->include("boost/typeof/typeof.hpp");
}
else if (text[0] == '#')
{
string name = text.substr(1);
file_ptr->include(string("boost/typeof/std/") + name + ".hpp");
}
else
{
(*file_ptr)(text);
}
}
return 0;
}
catch(const runtime_error& err)
{
cout << err.what() << endl;
return 1;
}
catch(const bad_lexical_cast& err)
{
cout << err.what() << endl;
return 1;
}
}

View File

@ -11,7 +11,7 @@ namespace boost
{
namespace
{
template<class V, class T> struct encode_type_impl;
template<class V, class Type_Not_Registered_With_Typeof_System> struct encode_type_impl;
template<class T, class Iter> struct decode_type_impl;
}

View File

@ -6,10 +6,46 @@
namespace
{
// functions
// function pointers
template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
struct encode_type_impl<V, R(*)(BOOST_PP_ENUM_PARAMS(n, P))>
{
typedef R BOOST_PP_CAT(P, n);
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_PTR_ID + n) type;
};
template<class Iter>
struct decode_type_impl<mpl::size_t<FUN_PTR_ID + n>, Iter>
{
typedef Iter iter0;
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
typedef BOOST_PP_CAT(p, n)(*type)(BOOST_PP_ENUM_PARAMS(n, p));
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
};
// function references
template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
struct encode_type_impl<V, R(&)(BOOST_PP_ENUM_PARAMS(n, P))>
{
typedef R BOOST_PP_CAT(P, n);
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_REF_ID + n) type;
};
template<class Iter>
struct decode_type_impl<mpl::size_t<FUN_REF_ID + n>, Iter>
{
typedef Iter iter0;
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
typedef BOOST_PP_CAT(p, n)(&type)(BOOST_PP_ENUM_PARAMS(n, p));
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
};
// functions
template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
struct encode_type_impl<V, R(BOOST_PP_ENUM_PARAMS(n, P))>
{
typedef R BOOST_PP_CAT(P, n);
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_ID + n) type;
@ -20,7 +56,7 @@ namespace
{
typedef Iter iter0;
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
typedef BOOST_PP_CAT(p, n)(*type)(BOOST_PP_ENUM_PARAMS(n, p));
typedef BOOST_PP_CAT(p, n)(type)(BOOST_PP_ENUM_PARAMS(n, p));
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
};

View File

@ -29,6 +29,7 @@
#define BOOST_TYPEOF_REGISTER_TEMPLATE_long_ BOOST_TYPEOF_REGISTER_TEMPLATE_integral(long)
#define BOOST_TYPEOF_REGISTER_TEMPLATE_bool_ BOOST_TYPEOF_REGISTER_TEMPLATE_integral(bool)
#define BOOST_TYPEOF_REGISTER_TEMPLATE_unsigned_ BOOST_TYPEOF_REGISTER_TEMPLATE_integral(unsigned)
#define BOOST_TYPEOF_REGISTER_TEMPLATE_size_t_ BOOST_TYPEOF_REGISTER_TEMPLATE_integral(size_t)
#define BOOST_TYPEOF_REGISTER_TEMPLATE_unsignedchar BOOST_TYPEOF_REGISTER_TEMPLATE_integral(unsigned char)
#define BOOST_TYPEOF_REGISTER_TEMPLATE_unsignedshort BOOST_TYPEOF_REGISTER_TEMPLATE_integral(unsigned short)
@ -49,6 +50,7 @@
#define BOOST_TYPEOF_class_BOOST_TYPEOF (class)(_)
#define BOOST_TYPEOF_typename_BOOST_TYPEOF (typename)(_)
#define BOOST_TYPEOF_unsigned_BOOST_TYPEOF (unsigned)(_)
#define BOOST_TYPEOF_size_t_BOOST_TYPEOF (size_t)(_)
#define char_BOOST_TYPEOF (char)
#define short_BOOST_TYPEOF (short)

View File

@ -24,10 +24,10 @@
enum
{
FUN_ID = BOOST_TYPEOF_UNIQUE_ID(),
FUN_REF_ID = FUN_ID + 1 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
MEM_FUN_ID = FUN_ID + 2 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
CONST_MEM_FUN_ID = FUN_ID + 3 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
CONST_VOID_MEM_FUN_ID = FUN_ID + 4 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
FUN_PTR_ID = FUN_ID + 1 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
FUN_REF_ID = FUN_ID + 2 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
MEM_FUN_ID = FUN_ID + 3 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
CONST_MEM_FUN_ID = FUN_ID + 4 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
VOLATILE_MEM_FUN_ID = FUN_ID + 5 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
VOLATILE_CONST_MEM_FUN_ID = FUN_ID + 6 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY)
};

View File

@ -0,0 +1,17 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_bitset_hpp_INCLUDED
#define BOOST_TYPEOF_STD_bitset_hpp_INCLUDED
#include <bitset>
#include <boost/typeof/typeof.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TEMPLATE_X(std::bitset, (size_t))
#endif//BOOST_TYPEOF_STD_bitset_hpp_INCLUDED

View File

@ -0,0 +1,21 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_deque_hpp_INCLUDED
#define BOOST_TYPEOF_STD_deque_hpp_INCLUDED
#include <deque>
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/memory.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#ifdef BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::deque, 1)
#endif//BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::deque, 2)
#endif//BOOST_TYPEOF_STD_deque_hpp_INCLUDED

View File

@ -0,0 +1,47 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_functional_hpp_INCLUDED
#define BOOST_TYPEOF_STD_functional_hpp_INCLUDED
#include <functional>
#include <boost/typeof/typeof.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TEMPLATE(std::unary_function, 2)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::binary_function, 3)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::plus, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::minus, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::multiplies, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::divides, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::modulus, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::negate, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::equal_to, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::not_equal_to, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::greater, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::less, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::greater_equal, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::less_equal, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::logical_and, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::logical_or, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::logical_not, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::unary_negate, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::binary_negate, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::binder1st, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::binder2nd, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::pointer_to_unary_function, 2)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::pointer_to_binary_function, 3)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::mem_fun_t, 2)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::mem_fun1_t, 3)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::mem_fun_ref_t, 2)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::mem_fun1_ref_t, 3)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::const_mem_fun_t, 2)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::const_mem_fun1_t, 3)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::const_mem_fun_ref_t, 2)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::const_mem_fun1_ref_t, 3)
#endif//BOOST_TYPEOF_STD_functional_hpp_INCLUDED

View File

@ -0,0 +1,21 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_list_hpp_INCLUDED
#define BOOST_TYPEOF_STD_list_hpp_INCLUDED
#include <list>
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/memory.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#ifdef BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::list, 1)
#endif//BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::list, 2)
#endif//BOOST_TYPEOF_STD_list_hpp_INCLUDED

View File

@ -0,0 +1,29 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_map_hpp_INCLUDED
#define BOOST_TYPEOF_STD_map_hpp_INCLUDED
#include <map>
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/memory.hpp>
#include <boost/typeof/std/functional.hpp>
#include <boost/typeof/std/utility.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#ifdef BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::map, 2)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::map, 3)
#endif//BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::map, 4)
#ifdef BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::multimap, 2)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::multimap, 3)
#endif//BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::multimap, 4)
#endif//BOOST_TYPEOF_STD_map_hpp_INCLUDED

View File

@ -0,0 +1,19 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_memory_hpp_INCLUDED
#define BOOST_TYPEOF_STD_memory_hpp_INCLUDED
#include <memory>
#include <boost/typeof/typeof.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TEMPLATE(std::allocator, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::raw_storage_iterator, 2)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::auto_ptr, 1)
#endif//BOOST_TYPEOF_STD_memory_hpp_INCLUDED

View File

@ -0,0 +1,21 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_queue_hpp_INCLUDED
#define BOOST_TYPEOF_STD_queue_hpp_INCLUDED
#include <queue>
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/memory.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#ifdef BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::queue, 1)
#endif//BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::queue, 2)
#endif//BOOST_TYPEOF_STD_queue_hpp_INCLUDED

View File

@ -0,0 +1,28 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_set_hpp_INCLUDED
#define BOOST_TYPEOF_STD_set_hpp_INCLUDED
#include <set>
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/memory.hpp>
#include <boost/typeof/std/functional.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#ifdef BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::set, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::set, 2)
#endif//BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::set, 3)
#ifdef BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::multiset, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::multiset, 2)
#endif//BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::multiset, 3)
#endif//BOOST_TYPEOF_STD_set_hpp_INCLUDED

View File

@ -0,0 +1,21 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_stack_hpp_INCLUDED
#define BOOST_TYPEOF_STD_stack_hpp_INCLUDED
#include <stack>
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/memory.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#ifdef BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::stack, 1)
#endif//BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::stack, 2)
#endif//BOOST_TYPEOF_STD_stack_hpp_INCLUDED

View File

@ -0,0 +1,23 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_string_hpp_INCLUDED
#define BOOST_TYPEOF_STD_string_hpp_INCLUDED
#include <string>
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/memory.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TEMPLATE(std::char_traits, 1)
#ifdef BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::basic_string, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::basic_string, 2)
#endif//BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::basic_string, 3)
#endif//BOOST_TYPEOF_STD_string_hpp_INCLUDED

View File

@ -0,0 +1,17 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_utility_hpp_INCLUDED
#define BOOST_TYPEOF_STD_utility_hpp_INCLUDED
#include <utility>
#include <boost/typeof/typeof.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TEMPLATE(std::pair, 2)
#endif//BOOST_TYPEOF_STD_utility_hpp_INCLUDED

View File

@ -0,0 +1,21 @@
// Copyright (C) 2004 Arkadiy Vertleyb, Peder Holt.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
// This is a generated file -- please do not modify.
#ifndef BOOST_TYPEOF_STD_vector_hpp_INCLUDED
#define BOOST_TYPEOF_STD_vector_hpp_INCLUDED
#include <vector>
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/memory.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#ifdef BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::vector, 1)
#endif//BOOST_TYPEOF_COMPLIANT
BOOST_TYPEOF_REGISTER_TEMPLATE(std::vector, 2)
#endif//BOOST_TYPEOF_STD_vector_hpp_INCLUDED

View File

@ -12,9 +12,11 @@
// BOOST_TYPEOF, BOOST_TYPEOF_TPL
#if defined(BOOST_TYPEOF_COMPLIANT)
# pragma message("using compliant imlementation")
# include <boost/typeof/compliant/typeof_impl.hpp>
#elif defined(BOOST_TYPEOF_VINTAGE)
# pragma message("using vintage imlementation")
# include <boost/typeof/vintage/typeof_impl.hpp>
#else//BOOST_TYPEOF_NATIVE

View File

@ -19,7 +19,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
AdditionalIncludeDirectories="C:\boost\boost_1_32_0;&quot;C:\ark\boost-sandbox\boost-sandbox&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
@ -68,7 +68,7 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="C:\boost\boost_1_32_0;../../../.."
AdditionalIncludeDirectories="&quot;C:\ark\boost-sandbox\boost-sandbox&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="4"
UsePrecompiledHeader="0"

View File

@ -8,34 +8,40 @@
#include <boost/detail/workaround.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/static_assert.hpp>
#include <boost/noncopyable.hpp>
#include <cassert>
#include <iostream>
#include <vector>
#include "stl/register.hpp"
#include "mpl/register.hpp"
#include <boost/typeof/std/string.hpp>
#include <boost/typeof/std/deque.hpp>
#include <boost/typeof/std/list.hpp>
#include <boost/typeof/std/queue.hpp>
#include <boost/typeof/std/stack.hpp>
#include <boost/typeof/std/vector.hpp>
#include <boost/typeof/std/map.hpp>
#include <boost/typeof/std/set.hpp>
#include <boost/typeof/std/bitset.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
using namespace std;
using namespace boost;
template<class T>
mpl::vector1<T> typeof_test_helper();
template<class T>
struct typeof_test
{
static T foo();
enum {value = boost::is_same<
#if BOOST_WORKAROUND(BOOST_MSVC,<=1300)
BOOST_TYPEOF_TPL(foo()), //MSVC 6.5 chokes when foo is fully qualified.
#else
BOOST_TYPEOF_TPL(typeof_test<T>::foo()), //fully qualify foo() to avoid problems with g++
#endif
typename boost::remove_reference<typename boost::remove_const<T>::type>::type
>::value};
BOOST_TYPEOF_TPL(typeof_test_helper<T>()),
mpl::vector1<T>
>::value
};
};
#pragma message("started")
@ -64,14 +70,21 @@ BOOST_TYPEOF_REGISTER_TEMPLATE_X(with_integrals,
BOOST_STATIC_ASSERT((typeof_test<with_integrals<int, 5, 4, 3, 2, true, false, 5> >::value));
BOOST_STATIC_ASSERT((typeof_test<with_integrals<int, 1, 1, 0, ULONG_MAX, false, true, 0> >::value));
#pragma message("namespace-level functions...")
#pragma message("namespace-level function pointers...")
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);
BOOST_STATIC_ASSERT(typeof_test<void(*)(int, double, short, char*, bool, char, float, long, unsigned short)>::value);
#pragma message("function references...")
BOOST_STATIC_ASSERT(typeof_test<int&>::value);
BOOST_STATIC_ASSERT(typeof_test<void(&)()>::value);
BOOST_STATIC_ASSERT(typeof_test<int(&)(int, short)>::value);
#ifdef BOOST_TYPEOF_COMPLIANT
# pragma message("function values...")
BOOST_STATIC_ASSERT(typeof_test<void()>::value);
BOOST_STATIC_ASSERT(typeof_test<double(bool)>::value);
#endif//BOOST_TYPEOF_COMPLIANT
#pragma message("member functions...")
BOOST_STATIC_ASSERT(typeof_test<double(x::*)()>::value);
@ -121,21 +134,30 @@ void lvalue_typeof_test()
BOOST_TYPEOF_REGISTER_TYPE(boost::noncopyable)
const boost::noncopyable& noncopiable_test_helper();
struct noncopiable_test
{
const boost::noncopyable& foo();
void bar()
{
#if BOOST_WORKAROUND(BOOST_MSVC,<=1200)
//MSVC chokes when typeof of return value of member function.
BOOST_AUTO(const& v, noncopiable_test().foo());
#else
BOOST_AUTO(const& v, foo());
#endif
BOOST_AUTO(const& v, noncopiable_test_helper());
v; // to avoid warning
}
};
#pragma message("STL...")
BOOST_STATIC_ASSERT(typeof_test<string>::value);
BOOST_STATIC_ASSERT(typeof_test<deque<int> >::value);
BOOST_STATIC_ASSERT(typeof_test<list<int> >::value);
BOOST_STATIC_ASSERT(typeof_test<queue<int> >::value);
BOOST_STATIC_ASSERT(typeof_test<stack<int> >::value);
BOOST_STATIC_ASSERT(typeof_test<vector<int> >::value);
BOOST_STATIC_ASSERT((typeof_test<map<int, int> >::value));
BOOST_STATIC_ASSERT((typeof_test<multimap<int, int> >::value));
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("ODR...")
void odr_test()