From 092974614fa380ee723f6b6b9571fe08e6aaa70b Mon Sep 17 00:00:00 2001 From: Arkadiy Vertleyb Date: Mon, 3 Jan 2005 02:54:20 +0000 Subject: [PATCH] stl registration [SVN r2426] --- genreg/genreg.sln | 21 +++ genreg/genreg.vcproj | 137 ++++++++++++++ genreg/input.txt | 100 ++++++++++ genreg/main.cpp | 172 ++++++++++++++++++ .../boost/typeof/compliant/encode_decode.hpp | 2 +- .../compliant/register_functions_iterate.hpp | 40 +++- .../typeof/compliant/template_encoding.hpp | 2 + include/boost/typeof/register_functions.hpp | 8 +- include/boost/typeof/std/bitset.hpp | 17 ++ include/boost/typeof/std/deque.hpp | 21 +++ include/boost/typeof/std/functional.hpp | 47 +++++ include/boost/typeof/std/list.hpp | 21 +++ include/boost/typeof/std/map.hpp | 29 +++ include/boost/typeof/std/memory.hpp | 19 ++ include/boost/typeof/std/queue.hpp | 21 +++ include/boost/typeof/std/set.hpp | 28 +++ include/boost/typeof/std/stack.hpp | 21 +++ include/boost/typeof/std/string.hpp | 23 +++ include/boost/typeof/std/utility.hpp | 17 ++ include/boost/typeof/std/vector.hpp | 21 +++ include/boost/typeof/typeof.hpp | 2 + test/compliant/typeof.vcproj | 4 +- test/main.cpp | 64 ++++--- 23 files changed, 807 insertions(+), 30 deletions(-) create mode 100755 genreg/genreg.sln create mode 100755 genreg/genreg.vcproj create mode 100755 genreg/input.txt create mode 100755 genreg/main.cpp create mode 100755 include/boost/typeof/std/bitset.hpp create mode 100755 include/boost/typeof/std/deque.hpp create mode 100755 include/boost/typeof/std/functional.hpp create mode 100755 include/boost/typeof/std/list.hpp create mode 100755 include/boost/typeof/std/map.hpp create mode 100755 include/boost/typeof/std/memory.hpp create mode 100755 include/boost/typeof/std/queue.hpp create mode 100755 include/boost/typeof/std/set.hpp create mode 100755 include/boost/typeof/std/stack.hpp create mode 100755 include/boost/typeof/std/string.hpp create mode 100755 include/boost/typeof/std/utility.hpp create mode 100755 include/boost/typeof/std/vector.hpp diff --git a/genreg/genreg.sln b/genreg/genreg.sln new file mode 100755 index 0000000..9b7aa1d --- /dev/null +++ b/genreg/genreg.sln @@ -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 diff --git a/genreg/genreg.vcproj b/genreg/genreg.vcproj new file mode 100755 index 0000000..a339565 --- /dev/null +++ b/genreg/genreg.vcproj @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/genreg/input.txt b/genreg/input.txt new file mode 100755 index 0000000..0ed4a3d --- /dev/null +++ b/genreg/input.txt @@ -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 diff --git a/genreg/main.cpp b/genreg/main.cpp new file mode 100755 index 0000000..f0b3d20 --- /dev/null +++ b/genreg/main.cpp @@ -0,0 +1,172 @@ +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace boost; + +template + 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(*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 > tokens(text, escaped_list_separator('\\', ',', '\"')); + + string what = getTokenAt(tokens, 0); + string name = getTokenAt(tokens, 1); + + if (what == "TEMPLATE") + { + int nMin = getTokenAt(tokens, 2); + int nMax = nMin; + + try + { + nMax = getTokenAt(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(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 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; + } +} diff --git a/include/boost/typeof/compliant/encode_decode.hpp b/include/boost/typeof/compliant/encode_decode.hpp index a7dc7d2..97b524b 100755 --- a/include/boost/typeof/compliant/encode_decode.hpp +++ b/include/boost/typeof/compliant/encode_decode.hpp @@ -11,7 +11,7 @@ namespace boost { namespace { - template struct encode_type_impl; + template struct encode_type_impl; template struct decode_type_impl; } diff --git a/include/boost/typeof/compliant/register_functions_iterate.hpp b/include/boost/typeof/compliant/register_functions_iterate.hpp index 78aecae..eb9e49a 100755 --- a/include/boost/typeof/compliant/register_functions_iterate.hpp +++ b/include/boost/typeof/compliant/register_functions_iterate.hpp @@ -6,10 +6,46 @@ namespace { - // functions + // function pointers template struct encode_type_impl + { + typedef R BOOST_PP_CAT(P, n); + typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_PTR_ID + n) type; + }; + + template + struct decode_type_impl, 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 + struct encode_type_impl + { + typedef R BOOST_PP_CAT(P, n); + typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_REF_ID + n) type; + }; + + template + struct decode_type_impl, 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 + struct encode_type_impl { 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; }; diff --git a/include/boost/typeof/compliant/template_encoding.hpp b/include/boost/typeof/compliant/template_encoding.hpp index 286dc87..3149897 100755 --- a/include/boost/typeof/compliant/template_encoding.hpp +++ b/include/boost/typeof/compliant/template_encoding.hpp @@ -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) diff --git a/include/boost/typeof/register_functions.hpp b/include/boost/typeof/register_functions.hpp index 4a1e218..f462a22 100755 --- a/include/boost/typeof/register_functions.hpp +++ b/include/boost/typeof/register_functions.hpp @@ -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) }; diff --git a/include/boost/typeof/std/bitset.hpp b/include/boost/typeof/std/bitset.hpp new file mode 100755 index 0000000..7102625 --- /dev/null +++ b/include/boost/typeof/std/bitset.hpp @@ -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 +#include + +#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() + +BOOST_TYPEOF_REGISTER_TEMPLATE_X(std::bitset, (size_t)) + +#endif//BOOST_TYPEOF_STD_bitset_hpp_INCLUDED diff --git a/include/boost/typeof/std/deque.hpp b/include/boost/typeof/std/deque.hpp new file mode 100755 index 0000000..ed1a216 --- /dev/null +++ b/include/boost/typeof/std/deque.hpp @@ -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 +#include +#include + +#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 diff --git a/include/boost/typeof/std/functional.hpp b/include/boost/typeof/std/functional.hpp new file mode 100755 index 0000000..6d55b4b --- /dev/null +++ b/include/boost/typeof/std/functional.hpp @@ -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 +#include + +#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 diff --git a/include/boost/typeof/std/list.hpp b/include/boost/typeof/std/list.hpp new file mode 100755 index 0000000..9dadeca --- /dev/null +++ b/include/boost/typeof/std/list.hpp @@ -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 +#include +#include + +#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 diff --git a/include/boost/typeof/std/map.hpp b/include/boost/typeof/std/map.hpp new file mode 100755 index 0000000..23a8987 --- /dev/null +++ b/include/boost/typeof/std/map.hpp @@ -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 +#include +#include +#include +#include + +#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 diff --git a/include/boost/typeof/std/memory.hpp b/include/boost/typeof/std/memory.hpp new file mode 100755 index 0000000..5cf4e4d --- /dev/null +++ b/include/boost/typeof/std/memory.hpp @@ -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 +#include + +#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 diff --git a/include/boost/typeof/std/queue.hpp b/include/boost/typeof/std/queue.hpp new file mode 100755 index 0000000..7ebe16a --- /dev/null +++ b/include/boost/typeof/std/queue.hpp @@ -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 +#include +#include + +#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 diff --git a/include/boost/typeof/std/set.hpp b/include/boost/typeof/std/set.hpp new file mode 100755 index 0000000..8a67f2a --- /dev/null +++ b/include/boost/typeof/std/set.hpp @@ -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 +#include +#include +#include + +#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 diff --git a/include/boost/typeof/std/stack.hpp b/include/boost/typeof/std/stack.hpp new file mode 100755 index 0000000..1393672 --- /dev/null +++ b/include/boost/typeof/std/stack.hpp @@ -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 +#include +#include + +#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 diff --git a/include/boost/typeof/std/string.hpp b/include/boost/typeof/std/string.hpp new file mode 100755 index 0000000..fd5b507 --- /dev/null +++ b/include/boost/typeof/std/string.hpp @@ -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 +#include +#include + +#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 diff --git a/include/boost/typeof/std/utility.hpp b/include/boost/typeof/std/utility.hpp new file mode 100755 index 0000000..9e45ced --- /dev/null +++ b/include/boost/typeof/std/utility.hpp @@ -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 +#include + +#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() + +BOOST_TYPEOF_REGISTER_TEMPLATE(std::pair, 2) + +#endif//BOOST_TYPEOF_STD_utility_hpp_INCLUDED diff --git a/include/boost/typeof/std/vector.hpp b/include/boost/typeof/std/vector.hpp new file mode 100755 index 0000000..5506b8d --- /dev/null +++ b/include/boost/typeof/std/vector.hpp @@ -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 +#include +#include + +#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 diff --git a/include/boost/typeof/typeof.hpp b/include/boost/typeof/typeof.hpp index 54f7b5d..ae60b0d 100755 --- a/include/boost/typeof/typeof.hpp +++ b/include/boost/typeof/typeof.hpp @@ -12,9 +12,11 @@ // BOOST_TYPEOF, BOOST_TYPEOF_TPL #if defined(BOOST_TYPEOF_COMPLIANT) +# pragma message("using compliant imlementation") # include #elif defined(BOOST_TYPEOF_VINTAGE) +# pragma message("using vintage imlementation") # include #else//BOOST_TYPEOF_NATIVE diff --git a/test/compliant/typeof.vcproj b/test/compliant/typeof.vcproj index b18137e..78ad775 100755 --- a/test/compliant/typeof.vcproj +++ b/test/compliant/typeof.vcproj @@ -19,7 +19,7 @@ #include -#include -#include #include #include #include #include -#include -#include "stl/register.hpp" #include "mpl/register.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() using namespace std; +using namespace boost; + +template +mpl::vector1 typeof_test_helper(); template 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::foo()), //fully qualify foo() to avoid problems with g++ -#endif - typename boost::remove_reference::type>::type - >::value}; + BOOST_TYPEOF_TPL(typeof_test_helper()), + mpl::vector1 + >::value + }; }; #pragma message("started") @@ -64,14 +70,21 @@ BOOST_TYPEOF_REGISTER_TEMPLATE_X(with_integrals, BOOST_STATIC_ASSERT((typeof_test >::value)); BOOST_STATIC_ASSERT((typeof_test >::value)); -#pragma message("namespace-level functions...") +#pragma message("namespace-level function pointers...") BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); #pragma message("function references...") -BOOST_STATIC_ASSERT(typeof_test::value); +BOOST_STATIC_ASSERT(typeof_test::value); +BOOST_STATIC_ASSERT(typeof_test::value); + +#ifdef BOOST_TYPEOF_COMPLIANT +# pragma message("function values...") + BOOST_STATIC_ASSERT(typeof_test::value); + BOOST_STATIC_ASSERT(typeof_test::value); +#endif//BOOST_TYPEOF_COMPLIANT #pragma message("member functions...") BOOST_STATIC_ASSERT(typeof_test::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::value); +BOOST_STATIC_ASSERT(typeof_test >::value); +BOOST_STATIC_ASSERT(typeof_test >::value); +BOOST_STATIC_ASSERT(typeof_test >::value); +BOOST_STATIC_ASSERT(typeof_test >::value); +BOOST_STATIC_ASSERT(typeof_test >::value); +BOOST_STATIC_ASSERT((typeof_test >::value)); +BOOST_STATIC_ASSERT((typeof_test >::value)); +BOOST_STATIC_ASSERT(typeof_test >::value); +BOOST_STATIC_ASSERT(typeof_test >::value); +BOOST_STATIC_ASSERT(typeof_test >::value); #pragma message("ODR...") void odr_test()