Compare commits

..

1 Commits

Author SHA1 Message Date
2dc55e34b3 Branch for developing Bitten client/server testing
[SVN r41004]
2007-11-10 22:53:12 +00:00
75 changed files with 78 additions and 117 deletions

0
include/boost/typeof/dmc/typeof_impl.hpp Normal file → Executable file
View File

0
include/boost/typeof/encode_decode.hpp Normal file → Executable file
View File

0
include/boost/typeof/encode_decode_params.hpp Normal file → Executable file
View File

0
include/boost/typeof/incr_registration_group.hpp Normal file → Executable file
View File

0
include/boost/typeof/int_encoding.hpp Normal file → Executable file
View File

0
include/boost/typeof/integral_template_param.hpp Normal file → Executable file
View File

0
include/boost/typeof/message.hpp Normal file → Executable file
View File

0
include/boost/typeof/modifiers.hpp Normal file → Executable file
View File

67
include/boost/typeof/msvc/typeof_impl.hpp Normal file → Executable file
View File

@ -104,7 +104,7 @@ namespace boost
typedef T type;
};
};
#elif BOOST_WORKAROUND(BOOST_MSVC,>=1400)
#elif BOOST_WORKAROUND(BOOST_MSVC,==1400)
struct msvc_extract_type_default_param {};
template<typename ID, typename T = msvc_extract_type_default_param>
@ -153,7 +153,57 @@ namespace boost
};
};
# endif
# if BOOST_WORKAROUND(BOOST_MSVC,>=1310)
template<const std::type_info& ref_type_info>
struct msvc_typeid_wrapper {
typedef typename msvc_extract_type<msvc_typeid_wrapper>::id2type id2type;
typedef typename id2type::type wrapped_type;
typedef typename wrapped_type::type type;
};
//This class is used for registering the type T. encode_type<T> is mapped against typeid(encode_type<T>).
//msvc_typeid_wrapper<typeid(encode_type<T>)> will now have a type typedef that equals encode_type<T>.
template<typename T>
struct encode_type
{
typedef encode_type<T> input_type;
//Invoke registration of encode_type<T>. typeid(encode_type<T>) is now mapped to encode_type<T>. Do not use registered_type for anything.
//The reason for registering encode_type<T> rather than T, is that VC handles typeid(function reference) poorly. By adding another
//level of indirection, we solve this problem.
typedef typename msvc_register_type<input_type,msvc_typeid_wrapper<typeid(input_type)> >::id2type registered_type;
typedef T type;
};
template<typename T> typename disable_if<
typename is_function<T>::type,
typename encode_type<T>::input_type>::type encode_start(T const&);
template<typename T> typename enable_if<
typename is_function<T>::type,
typename encode_type<T>::input_type>::type encode_start(T&);
template<typename Organizer, typename T>
msvc_register_type<T,Organizer> typeof_register_type(const T&);
# define BOOST_TYPEOF(expr) \
boost::type_of::msvc_typeid_wrapper<typeid(boost::type_of::encode_start(expr))>::type
# define BOOST_TYPEOF_TPL(expr) typename BOOST_TYPEOF(expr)
# define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
struct name {\
enum {_typeof_register_value=sizeof(typeid(boost::type_of::typeof_register_type<name>(expr)))};\
typedef typename boost::type_of::msvc_extract_type<name>::id2type id2type;\
typedef typename id2type::type type;\
};
# define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
struct name {\
enum {_typeof_register_value=sizeof(typeid(boost::type_of::typeof_register_type<name>(expr)))};\
typedef boost::type_of::msvc_extract_type<name>::id2type id2type;\
typedef id2type::type type;\
};
# else
template<int ID>
struct msvc_typeid_wrapper {
typedef typename msvc_extract_type<mpl::int_<ID> >::id2type id2type;
@ -189,18 +239,10 @@ namespace boost
{
typedef char(*type)[encode_type<T>::value];
};
# if BOOST_WORKAROUND(BOOST_MSVC,>=1310)
template<typename T> typename disable_if<
typename is_function<T>::type,
typename sizer<T>::type>::type encode_start(T const&);
template<typename T> typename enable_if<
typename is_function<T>::type,
typename sizer<T>::type>::type encode_start(T&);
# else
template<typename T>
typename sizer<T>::type encode_start(T const&);
# endif
template<typename Organizer, typename T>
msvc_register_type<T,Organizer> typeof_register_type(const T&,Organizer* =0);
@ -211,18 +253,19 @@ namespace boost
# define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
struct name {\
enum {_typeof_register_value=sizeof(boost::type_of::typeof_register_type<name>(expr))};\
BOOST_STATIC_CONSTANT(int,_typeof_register_value=sizeof(boost::type_of::typeof_register_type<name>(expr)));\
typedef typename boost::type_of::msvc_extract_type<name>::id2type id2type;\
typedef typename id2type::type type;\
};
# define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
struct name {\
enum {_typeof_register_value=sizeof(boost::type_of::typeof_register_type<name>(expr))};\
BOOST_STATIC_CONSTANT(int,_typeof_register_value=sizeof(boost::type_of::typeof_register_type<name>(expr)));\
typedef boost::type_of::msvc_extract_type<name>::id2type id2type;\
typedef id2type::type type;\
};
#endif
}
}

0
include/boost/typeof/native.hpp Normal file → Executable file
View File

0
include/boost/typeof/pointers_data_members.hpp Normal file → Executable file
View File

19
include/boost/typeof/register_functions.hpp Normal file → Executable file
View File

@ -24,19 +24,12 @@
enum
{
FUN_ID = BOOST_TYPEOF_UNIQUE_ID(),
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),
FUN_VAR_ID = FUN_ID + 7 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
FUN_VAR_PTR_ID = FUN_ID + 8 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
FUN_VAR_REF_ID = FUN_ID + 9 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
MEM_FUN_VAR_ID = FUN_ID + 10 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
CONST_MEM_FUN_VAR_ID = FUN_ID + 11 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
VOLATILE_MEM_FUN_VAR_ID = FUN_ID + 12 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
VOLATILE_CONST_MEM_FUN_VAR_ID = FUN_ID + 13 * 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)
};
BOOST_TYPEOF_BEGIN_ENCODE_NS

48
include/boost/typeof/register_functions_iterate.hpp Normal file → Executable file
View File

@ -15,13 +15,6 @@ struct encode_type_impl<V, R(*)(BOOST_PP_ENUM_PARAMS(n, P))>
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_PTR_ID + n) type;
};
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_VAR_PTR_ID + n) type;
};
template<class Iter>
struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
{
@ -31,15 +24,6 @@ struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
};
template<class Iter>
struct decode_type_impl<boost::mpl::size_t<FUN_VAR_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;
};
#ifndef BOOST_TYPEOF_NO_FUNCTION_TYPES
// function references
@ -51,13 +35,6 @@ struct decode_type_impl<boost::mpl::size_t<FUN_VAR_PTR_ID + n>, Iter>
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_REF_ID + n) type;
};
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_VAR_REF_ID + n) type;
};
template<class Iter>
struct decode_type_impl<boost::mpl::size_t<FUN_REF_ID + n>, Iter>
{
@ -67,15 +44,6 @@ struct decode_type_impl<boost::mpl::size_t<FUN_VAR_PTR_ID + n>, Iter>
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
};
template<class Iter>
struct decode_type_impl<boost::mpl::size_t<FUN_VAR_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)>
@ -85,13 +53,6 @@ struct decode_type_impl<boost::mpl::size_t<FUN_VAR_PTR_ID + n>, Iter>
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_ID + n) type;
};
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_VAR_ID + n) type;
};
template<class Iter>
struct decode_type_impl<boost::mpl::size_t<FUN_ID + n>, Iter>
{
@ -101,15 +62,6 @@ struct decode_type_impl<boost::mpl::size_t<FUN_VAR_PTR_ID + n>, Iter>
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
};
template<class Iter>
struct decode_type_impl<boost::mpl::size_t<FUN_VAR_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;
};
#endif//BOOST_TYPEOF_NO_FUNCTION_TYPES
#ifndef BOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES

0
include/boost/typeof/register_fundamental.hpp Normal file → Executable file
View File

0
include/boost/typeof/register_mem_functions.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/bitset.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/complex.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/deque.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/fstream.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/functional.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/iostream.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/istream.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/iterator.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/list.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/locale.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/map.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/memory.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/ostream.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/queue.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/set.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/sstream.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/stack.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/streambuf.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/string.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/utility.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/valarray.hpp Normal file → Executable file
View File

0
include/boost/typeof/std/vector.hpp Normal file → Executable file
View File

0
include/boost/typeof/template_encoding.hpp Normal file → Executable file
View File

0
include/boost/typeof/template_template_param.hpp Normal file → Executable file
View File

0
include/boost/typeof/type_encoding.hpp Normal file → Executable file
View File

0
include/boost/typeof/type_template_param.hpp Normal file → Executable file
View File

0
include/boost/typeof/typeof.hpp Normal file → Executable file
View File

0
include/boost/typeof/typeof_impl.hpp Normal file → Executable file
View File

0
include/boost/typeof/vector.hpp Normal file → Executable file
View File

0
include/boost/typeof/vector100.hpp Normal file → Executable file
View File

0
include/boost/typeof/vector150.hpp Normal file → Executable file
View File

0
include/boost/typeof/vector200.hpp Normal file → Executable file
View File

0
include/boost/typeof/vector50.hpp Normal file → Executable file
View File

2
index.html Normal file → Executable file
View File

@ -10,7 +10,7 @@ License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
</head>
<body>
Automatic redirection failed, please go to
<a href="../../doc/html/typeof.html">../../doc/html/typeof.html</a>
<a href="../../doc/html/xpressive.html">../../doc/html/typeof.html</a>
</body>
</html>

0
test/data_member.cpp Normal file → Executable file
View File

2
test/function.cpp Normal file → Executable file
View File

@ -6,5 +6,3 @@
BOOST_STATIC_ASSERT(boost::type_of::test<void()>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<double(bool)>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<void(...)>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<float(int, ...)>::value);

16
test/function_binding.cpp Normal file → Executable file
View File

@ -7,16 +7,8 @@
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
int foo1(double);
int foo2(...);
int foo3(int, ...);
typedef int(&FREF1)(double);
typedef int(&FREF2)(...);
typedef int(&FREF3)(int, ...);
FREF1 fref1 = *foo1;
FREF2 fref2 = *foo2;
FREF3 fref3 = *foo3;
int foo(double);
typedef int(&FREF)(double);
FREF fref = *foo;
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref1), int(double)>::value));
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref2), int(...)>::value));
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref3), int(int,...)>::value));
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref), int(double)>::value));

17
test/function_ptr.cpp Normal file → Executable file
View File

@ -8,19 +8,12 @@ BOOST_STATIC_ASSERT(boost::type_of::test<double(*)()>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<double(*)(int, double, short, char*, bool, char, float, long, unsigned short)>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<void(*)()>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<void(*)(int, double, short, char*, bool, char, float, long, unsigned short)>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<void(*)(...)>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<void(*)(int, double, short, char*, bool, char, float, long, unsigned short, ...)>::value);
// check that const gets stripped from function pointer
int foo1(double);
int foo2(...);
typedef int(*PTR1)(double);
typedef int(*PTR2)(...);
typedef const PTR1 CPTR1;
typedef const PTR2 CPTR2;
CPTR1 cptr1 = foo1;
CPTR2 cptr2 = foo2;
int foo(double);
typedef int(*PTR)(double);
typedef const PTR CPTR;
CPTR cptr = foo;
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(cptr1), PTR1>::value));
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(cptr2), PTR2>::value));
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(cptr), PTR>::value));

20
test/function_ptr_from_tpl.cpp Normal file → Executable file
View File

@ -6,23 +6,15 @@
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
void f1() {}
void f2(...) {}
void f()
{}
template<class T>
struct tpl1
struct tpl
{
typedef BOOST_TYPEOF_TPL(&f1) type;
typedef BOOST_TYPEOF_TPL(&f) type;
};
template<class T>
struct tpl2
{
typedef BOOST_TYPEOF_TPL(&f2) type;
};
typedef void(*fun1_type)();
typedef void(*fun2_type)(...);
typedef void(*fun_type)();
BOOST_STATIC_ASSERT((boost::is_same<tpl1<void>::type, fun1_type>::value));
BOOST_STATIC_ASSERT((boost::is_same<tpl2<void>::type, fun2_type>::value));
BOOST_STATIC_ASSERT((boost::is_same<tpl<void>::type, fun_type>::value));

2
test/function_ref.cpp Normal file → Executable file
View File

@ -6,5 +6,3 @@
BOOST_STATIC_ASSERT(boost::type_of::test<void(&)()>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<int(&)(int, short)>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<int(&)(...)>::value);
BOOST_STATIC_ASSERT(boost::type_of::test<int(&)(int,...)>::value);

0
test/member_function.cpp Normal file → Executable file
View File

0
test/modifiers.cpp Normal file → Executable file
View File

0
test/noncopyable.cpp Normal file → Executable file
View File

0
test/odr.hpp Normal file → Executable file
View File

0
test/odr1.cpp Normal file → Executable file
View File

0
test/odr2.cpp Normal file → Executable file
View File

0
test/odr_no_uns1.cpp Normal file → Executable file
View File

0
test/odr_no_uns1.hpp Normal file → Executable file
View File

0
test/odr_no_uns2.cpp Normal file → Executable file
View File

0
test/odr_no_uns2.hpp Normal file → Executable file
View File

0
test/std.cpp Normal file → Executable file
View File

0
test/template_dependent.cpp Normal file → Executable file
View File

0
test/template_enum.cpp Normal file → Executable file
View File

0
test/template_int.cpp Normal file → Executable file
View File

0
test/template_multiword.cpp Normal file → Executable file
View File

0
test/template_tpl.cpp Normal file → Executable file
View File

0
test/template_type.cpp Normal file → Executable file
View File

0
test/test.hpp Normal file → Executable file
View File

0
test/type.cpp Normal file → Executable file
View File

View File

@ -1,7 +1,7 @@
# // (C) Copyright Tobias Schwinger
# //
# // Use modification and distribution are subject to the boost Software License
# // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
# // Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt).
# // Preprocess and run this script.
# //