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