mirror of
https://github.com/boostorg/typeof.git
synced 2025-07-31 21:34:42 +02:00
Removed the vintage implementation and moved compliant implementation to the typeof folder.
[SVN r2570]
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
// Copyright (C) 2005 Arkadiy Vertleyb
|
||||
// Copyright (C) 2005 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_INTEGRAL_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_INTEGRAL_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/integral_template_param.hpp>
|
||||
|
||||
// INTEGRAL_PARAM "virtual functions" implementation
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_ENCODE(This, n)\
|
||||
typedef typename encode_integral<\
|
||||
BOOST_PP_CAT(V, n),\
|
||||
BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(This),\
|
||||
BOOST_PP_CAT(P, n)\
|
||||
>::type BOOST_PP_CAT(V, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_DECODE(This, n)\
|
||||
typedef decode_integral<BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(This), BOOST_PP_CAT(iter, n)> BOOST_PP_CAT(d, n);\
|
||||
static const BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(This) BOOST_PP_CAT(P, n) = BOOST_PP_CAT(d, n)::value;\
|
||||
typedef typename BOOST_PP_CAT(d, n)::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_PLACEHOLDER(Param)\
|
||||
(BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(Param))0
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_DECLARATION_TYPE(Param)\
|
||||
BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(Param)
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_PLACEHOLDER_TYPES(Param, n)\
|
||||
BOOST_PP_CAT(T,n)
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_ISTEMPLATE 0
|
||||
|
||||
|
||||
#endif//BOOST_TYPEOF_COMPLIANT_INTEGRAL_TEMPLATE_PARAM_HPP_INCLUDED
|
@@ -1,54 +0,0 @@
|
||||
// Copyright (C) 2004 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_LVALUE_TYPEOF_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_LVALUE_TYPEOF_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace type_of
|
||||
{
|
||||
enum
|
||||
{
|
||||
RVALUE = 1,
|
||||
LVALUE,
|
||||
CONST_LVALUE
|
||||
};
|
||||
|
||||
char(&classify_expression(...))[
|
||||
RVALUE
|
||||
];
|
||||
|
||||
template<class T>
|
||||
char(&classify_expression(T&))[
|
||||
is_const<T>::value ? CONST_LVALUE : LVALUE
|
||||
];
|
||||
|
||||
template<class T, int n> struct decorate_type
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
template<class T> struct decorate_type<T, LVALUE>
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
template<class T> struct decorate_type<T, CONST_LVALUE>
|
||||
{
|
||||
typedef const T& type;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Since this is always a type,
|
||||
// just add "typename" when using in templates
|
||||
|
||||
#define BOOST_LVALUE_TYPEOF(expr) \
|
||||
boost::type_of::decorate_type< \
|
||||
BOOST_TYPEOF(expr), \
|
||||
sizeof(boost::type_of::classify_expression(expr)) \
|
||||
>::type
|
||||
|
||||
#endif//BOOST_TYPEOF_COMPLIANT_LVALUE_TYPEOF_HPP_INCLUDED
|
@@ -1,74 +0,0 @@
|
||||
// Copyright (C) 2004 Arkadiy Vertleyb
|
||||
// Copyright (C) 2005 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_TEMPLATE_ENCODING_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_TEMPLATE_ENCODING_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/compliant/encode_decode.hpp>
|
||||
#include <boost/typeof/compliant/int_encoding.hpp>
|
||||
|
||||
#include <boost/typeof/template_encoding.hpp>
|
||||
|
||||
#include <boost/typeof/compliant/type_template_param.hpp>
|
||||
#include <boost/typeof/compliant/integral_template_param.hpp>
|
||||
#include <boost/typeof/compliant/template_template_param.hpp>
|
||||
|
||||
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_PLACEHOLDER(z, n, elem)\
|
||||
BOOST_TYPEOF_VIRTUAL(PLACEHOLDER, elem)(elem)
|
||||
|
||||
#define BOOST_TYPEOF_PLACEHOLDER_TYPES(z, n, elem)\
|
||||
BOOST_TYPEOF_VIRTUAL(PLACEHOLDER_TYPES, elem)(elem, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM(r, data, n, elem)\
|
||||
BOOST_TYPEOF_VIRTUAL(ENCODE, elem)(elem, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM(r, data, n, elem)\
|
||||
BOOST_TYPEOF_VIRTUAL(DECODE, elem)(elem, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_PAIR(z, n, elem) \
|
||||
BOOST_TYPEOF_VIRTUAL(EXPANDTYPE, elem)(elem) BOOST_PP_CAT(P, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_DEFAULT_TEMPLATE_TYPE(Name,Params,ID)\
|
||||
Name< BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params), P) >
|
||||
|
||||
//Since we are creating an internal decode struct, we need to use different template names, T instead of P.
|
||||
#define BOOST_TYPEOF_REGISTER_DECODER_TYPE_PARAM_PAIR(z,n,elem) \
|
||||
BOOST_TYPEOF_VIRTUAL(EXPANDTYPE, elem)(elem) BOOST_PP_CAT(T, n)
|
||||
|
||||
//Default template param decoding
|
||||
#define BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TYPE(Name,Params)\
|
||||
typedef Name<BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params),P)> type;
|
||||
|
||||
//Branch the decoding
|
||||
#define BOOST_TYPEOF_TYPEDEF_DECODED_TYPE(Name,Params)\
|
||||
BOOST_PP_IF(BOOST_TYPEOF_HAS_TEMPLATES(Params),\
|
||||
BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TEMPLATE_TYPE,\
|
||||
BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TYPE)(Name,Params)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_IMPL(Name, Params, Size, ID)\
|
||||
namespace boost{namespace type_of{namespace{\
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE_TEMPLATE_IMPL(Name, Params, ID)\
|
||||
template<class V\
|
||||
BOOST_TYPEOF_SEQ_ENUM_TRAILING(Params, BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_PAIR)\
|
||||
>\
|
||||
struct encode_type_impl<V, Name<BOOST_PP_ENUM_PARAMS(Size, P)> >\
|
||||
{\
|
||||
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;\
|
||||
};\
|
||||
template<class Iter>\
|
||||
struct decode_type_impl<boost::mpl::size_t<ID>, Iter>\
|
||||
{\
|
||||
typedef Iter iter0;\
|
||||
BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM, ~, Params)\
|
||||
BOOST_TYPEOF_TYPEDEF_DECODED_TYPE(Name, Params)\
|
||||
typedef BOOST_PP_CAT(iter, Size) iter;\
|
||||
};\
|
||||
}}}
|
||||
|
||||
#endif//BOOST_TYPEOF_COMPLIANT_TEMPLATE_ENCODING_HPP_INCLUDED
|
@@ -1,29 +0,0 @@
|
||||
// Copyright (C) 2005 Arkadiy Vertleyb
|
||||
// Copyright (C) 2005 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_TYPE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_TYPE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/type_template_param.hpp>
|
||||
|
||||
// TYPE_PARAM "virtual functions" implementation
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_ENCODE(This, n)\
|
||||
typedef typename encode_type<\
|
||||
BOOST_PP_CAT(V, n),\
|
||||
BOOST_PP_CAT(P, n)\
|
||||
>::type BOOST_PP_CAT(V, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_DECODE(This, n)\
|
||||
typedef decode_type< BOOST_PP_CAT(iter, n) > BOOST_PP_CAT(d, n);\
|
||||
typedef typename BOOST_PP_CAT(d, n)::type BOOST_PP_CAT(P, n);\
|
||||
typedef typename BOOST_PP_CAT(d, n)::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_PLACEHOLDER(Param) int
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_DECLARATION_TYPE(Param) class
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_PLACEHOLDER_TYPES(Param, n) BOOST_PP_CAT(T,n)
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_ISTEMPLATE 0
|
||||
|
||||
#endif//BOOST_TYPEOF_COMPLIANT_TYPE_TEMPLATE_PARAM_HPP_INCLUDED
|
@@ -8,9 +8,7 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_TYPEOF_COMPLIANT) &&\
|
||||
!defined(BOOST_TYPEOF_VINTAGE) &&\
|
||||
!defined(BOOST_TYPEOF_NATIVE) &&\
|
||||
!defined(BOOST_TYPEOF_MSVC)
|
||||
!defined(BOOST_TYPEOF_NATIVE)
|
||||
|
||||
# if defined __GNUC__
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
@@ -22,19 +20,11 @@
|
||||
//Doesn't require registration
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
|
||||
# elif defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# define BOOST_TYPEOF_VINTAGE
|
||||
|
||||
# else
|
||||
# elif !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# define BOOST_TYPEOF_COMPLIANT
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_TYPEOF_VINTAGE
|
||||
#include <boost/typeof/vintage/config.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
#endif//BOOST_TYPEOF_CONFIG_HPP_INCLUDED
|
||||
|
0
include/boost/typeof/compliant/encode_decode.hpp → include/boost/typeof/encode_decode.hpp
Executable file → Normal file
0
include/boost/typeof/compliant/encode_decode.hpp → include/boost/typeof/encode_decode.hpp
Executable file → Normal file
6
include/boost/typeof/compliant/encode_decode_params.hpp → include/boost/typeof/encode_decode_params.hpp
Executable file → Normal file
6
include/boost/typeof/compliant/encode_decode_params.hpp → include/boost/typeof/encode_decode_params.hpp
Executable file → Normal file
@@ -2,8 +2,8 @@
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
#ifndef BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
@@ -31,4 +31,4 @@
|
||||
typename mpl::push_back<V, mpl::size_t<ID> >::type \
|
||||
BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_END, ~)
|
||||
|
||||
#endif//BOOST_TYPEOF_COMPLIANT_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
#endif//BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
0
include/boost/typeof/compliant/int_encoding.hpp → include/boost/typeof/int_encoding.hpp
Executable file → Normal file
0
include/boost/typeof/compliant/int_encoding.hpp → include/boost/typeof/int_encoding.hpp
Executable file → Normal file
@@ -52,4 +52,29 @@
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_EXPANDTYPE(Param)\
|
||||
BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(Param)
|
||||
|
||||
// INTEGRAL_PARAM "virtual functions" implementation
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_ENCODE(This, n)\
|
||||
typedef typename encode_integral<\
|
||||
BOOST_PP_CAT(V, n),\
|
||||
BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(This),\
|
||||
BOOST_PP_CAT(P, n)\
|
||||
>::type BOOST_PP_CAT(V, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_DECODE(This, n)\
|
||||
typedef decode_integral<BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(This), BOOST_PP_CAT(iter, n)> BOOST_PP_CAT(d, n);\
|
||||
static const BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(This) BOOST_PP_CAT(P, n) = BOOST_PP_CAT(d, n)::value;\
|
||||
typedef typename BOOST_PP_CAT(d, n)::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_PLACEHOLDER(Param)\
|
||||
(BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(Param))0
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_DECLARATION_TYPE(Param)\
|
||||
BOOST_TYPEOF_INTEGRAL_PARAM_GETTYPE(Param)
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_PLACEHOLDER_TYPES(Param, n)\
|
||||
BOOST_PP_CAT(T,n)
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_ISTEMPLATE 0
|
||||
|
||||
#endif//BOOST_TYPEOF_INTEGRAL_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
|
6
include/boost/typeof/compliant/limit_size.hpp → include/boost/typeof/limit_size.hpp
Executable file → Normal file
6
include/boost/typeof/compliant/limit_size.hpp → include/boost/typeof/limit_size.hpp
Executable file → Normal file
@@ -2,8 +2,8 @@
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_LIMIT_SIZE_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_LIMIT_SIZE_HPP_INCLUDED
|
||||
#ifndef BOOST_TYPEOF_LIMIT_SIZE_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_LIMIT_SIZE_HPP_INCLUDED
|
||||
|
||||
#include "boost/mpl/vector.hpp"
|
||||
#include "boost/mpl/aux_/config/ctps.hpp"
|
||||
@@ -32,4 +32,4 @@ namespace boost
|
||||
|
||||
#endif//BOOST_TYPEOF_LIMIT_SIZE > BOOST_MPL_LIMIT_VECTOR_SIZE
|
||||
|
||||
#endif//BOOST_TYPEOF_COMPLIANT_LIMIT_SIZE_HPP_INCLUDED
|
||||
#endif//BOOST_TYPEOF_LIMIT_SIZE_HPP_INCLUDED
|
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2004 Arkadiy Vertleyb
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_VINTAGE_LVALUE_TYPEOF_HPP_INCLUDED
|
||||
#define BOOST_VINTAGE_LVALUE_TYPEOF_HPP_INCLUDED
|
||||
#ifndef BOOST_TYPEOF_LVALUE_TYPEOF_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_LVALUE_TYPEOF_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
@@ -26,6 +27,20 @@ namespace boost
|
||||
char(*classify_expression(T&))[
|
||||
is_const<T>::value ? CONST_LVALUE : LVALUE
|
||||
];
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
template<class T, int n> struct decorate_type
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
template<class T> struct decorate_type<T, LVALUE>
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
template<class T> struct decorate_type<T, CONST_LVALUE>
|
||||
{
|
||||
typedef const T& type;
|
||||
};
|
||||
#else
|
||||
template<int n>
|
||||
struct decorate_type_impl {
|
||||
template<typename T>
|
||||
@@ -53,9 +68,11 @@ namespace boost
|
||||
{
|
||||
typedef decorate_type_impl<n>::inner<T>::type type;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Since this is always a type,
|
||||
// just add "typename" when using in templates
|
||||
|
||||
@@ -66,4 +83,4 @@ namespace boost
|
||||
>::type
|
||||
|
||||
|
||||
#endif //BOOST_VINTAGE_LVALUE_TYPEOF_HPP_INCLUDED
|
||||
#endif//BOOST_TYPEOF_LVALUE_TYPEOF_HPP_INCLUDED
|
8
include/boost/typeof/compliant/modifiers.hpp → include/boost/typeof/modifiers.hpp
Executable file → Normal file
8
include/boost/typeof/compliant/modifiers.hpp → include/boost/typeof/modifiers.hpp
Executable file → Normal file
@@ -2,10 +2,10 @@
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_MODIFIERS_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_MODIFIERS_HPP_INCLUDED
|
||||
#ifndef BOOST_TYPEOF_MODIFIERS_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_MODIFIERS_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/compliant/encode_decode.hpp>
|
||||
#include <boost/typeof/encode_decode.hpp>
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
@@ -88,4 +88,4 @@ namespace boost{namespace type_of{namespace{
|
||||
|
||||
#undef BOOST_TYPEOF_array_support
|
||||
|
||||
#endif//BOOST_TYPEOF_COMPLIANT_MODIFIERS_HPP_INCLUDED
|
||||
#endif//BOOST_TYPEOF_MODIFIERS_HPP_INCLUDED
|
10
include/boost/typeof/compliant/pointers_data_members.hpp → include/boost/typeof/pointers_data_members.hpp
Executable file → Normal file
10
include/boost/typeof/compliant/pointers_data_members.hpp → include/boost/typeof/pointers_data_members.hpp
Executable file → Normal file
@@ -2,11 +2,11 @@
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_POINTERS_DATA_MEMBERS_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_POINTERS_DATA_MEMBERS_HPP_INCLUDED
|
||||
#ifndef BOOST_TYPEOF_POINTERS_DATA_MEMBERS_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_POINTERS_DATA_MEMBERS_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/compliant/encode_decode_params.hpp>
|
||||
#include <boost/typeof/compliant/encode_decode.hpp>
|
||||
#include <boost/typeof/encode_decode_params.hpp>
|
||||
#include <boost/typeof/encode_decode.hpp>
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
@@ -41,4 +41,4 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
#endif//BOOST_TYPEOF_COMPLIANT_POINTERS_DATA_MEMBERS_HPP_INCLUDED
|
||||
#endif//BOOST_TYPEOF_POINTERS_DATA_MEMBERS_HPP_INCLUDED
|
@@ -37,8 +37,8 @@ namespace boost
|
||||
namespace type_of
|
||||
{
|
||||
# define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPEOF_LIMIT_FUNCTION_ARITY)
|
||||
// BOOST_PP_FILENAME_1 is defined outside
|
||||
# include BOOST_PP_ITERATE()
|
||||
# define BOOST_PP_FILENAME_1 <boost/typeof/register_functions_iterate.hpp>
|
||||
# include BOOST_PP_ITERATE()
|
||||
}
|
||||
}
|
||||
|
||||
|
10
include/boost/typeof/compliant/register_functions_iterate.hpp → include/boost/typeof/register_functions_iterate.hpp
Executable file → Normal file
10
include/boost/typeof/compliant/register_functions_iterate.hpp → include/boost/typeof/register_functions_iterate.hpp
Executable file → Normal file
@@ -2,7 +2,7 @@
|
||||
// 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/compliant/encode_decode_params.hpp>
|
||||
#include <boost/typeof/encode_decode_params.hpp>
|
||||
|
||||
#define n BOOST_PP_ITERATION()
|
||||
|
||||
@@ -66,19 +66,19 @@ namespace
|
||||
|
||||
#define BOOST_TYPEOF_qualifier
|
||||
#define BOOST_TYPEOF_id MEM_FUN_ID
|
||||
#include <boost/typeof/compliant/register_mem_functions.hpp>
|
||||
#include <boost/typeof/register_mem_functions.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_qualifier const
|
||||
#define BOOST_TYPEOF_id CONST_MEM_FUN_ID
|
||||
#include <boost/typeof/compliant/register_mem_functions.hpp>
|
||||
#include <boost/typeof/register_mem_functions.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_qualifier volatile
|
||||
#define BOOST_TYPEOF_id VOLATILE_MEM_FUN_ID
|
||||
#include <boost/typeof/compliant/register_mem_functions.hpp>
|
||||
#include <boost/typeof/register_mem_functions.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_qualifier volatile const
|
||||
#define BOOST_TYPEOF_id VOLATILE_CONST_MEM_FUN_ID
|
||||
#include <boost/typeof/compliant/register_mem_functions.hpp>
|
||||
#include <boost/typeof/register_mem_functions.hpp>
|
||||
}
|
||||
|
||||
#undef n
|
@@ -1,4 +1,5 @@
|
||||
// Copyright (C) 2004 Arkadiy Vertleyb
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
2
include/boost/typeof/compliant/register_mem_functions.hpp → include/boost/typeof/register_mem_functions.hpp
Executable file → Normal file
2
include/boost/typeof/compliant/register_mem_functions.hpp → include/boost/typeof/register_mem_functions.hpp
Executable file → Normal file
@@ -2,7 +2,7 @@
|
||||
// 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/compliant/encode_decode_params.hpp>
|
||||
#include <boost/typeof/encode_decode_params.hpp>
|
||||
|
||||
// member functions
|
||||
|
@@ -13,6 +13,16 @@
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/seq/transform.hpp>
|
||||
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
|
||||
#include <boost/typeof/encode_decode.hpp>
|
||||
#include <boost/typeof/int_encoding.hpp>
|
||||
|
||||
#include <boost/typeof/type_template_param.hpp>
|
||||
#include <boost/typeof/integral_template_param.hpp>
|
||||
#include <boost/typeof/template_template_param.hpp>
|
||||
|
||||
|
||||
|
||||
// The template parameter description, entered by the user,
|
||||
// is converted into a polymorphic "object"
|
||||
@@ -81,4 +91,58 @@
|
||||
#define BOOST_TYPEOF_SEQ_ENUM_TRAILING_1(seq,macro)\
|
||||
BOOST_PP_ENUM_TRAILING(BOOST_PP_SEQ_SIZE(seq),BOOST_TYPEOF_SEQ_EXPAND_ELEMENT_1,(macro)(seq))
|
||||
|
||||
#define BOOST_TYPEOF_PLACEHOLDER(z, n, elem)\
|
||||
BOOST_TYPEOF_VIRTUAL(PLACEHOLDER, elem)(elem)
|
||||
|
||||
#define BOOST_TYPEOF_PLACEHOLDER_TYPES(z, n, elem)\
|
||||
BOOST_TYPEOF_VIRTUAL(PLACEHOLDER_TYPES, elem)(elem, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM(r, data, n, elem)\
|
||||
BOOST_TYPEOF_VIRTUAL(ENCODE, elem)(elem, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM(r, data, n, elem)\
|
||||
BOOST_TYPEOF_VIRTUAL(DECODE, elem)(elem, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_PAIR(z, n, elem) \
|
||||
BOOST_TYPEOF_VIRTUAL(EXPANDTYPE, elem)(elem) BOOST_PP_CAT(P, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_DEFAULT_TEMPLATE_TYPE(Name,Params,ID)\
|
||||
Name< BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params), P) >
|
||||
|
||||
//Since we are creating an internal decode struct, we need to use different template names, T instead of P.
|
||||
#define BOOST_TYPEOF_REGISTER_DECODER_TYPE_PARAM_PAIR(z,n,elem) \
|
||||
BOOST_TYPEOF_VIRTUAL(EXPANDTYPE, elem)(elem) BOOST_PP_CAT(T, n)
|
||||
|
||||
//Default template param decoding
|
||||
#define BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TYPE(Name,Params)\
|
||||
typedef Name<BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params),P)> type;
|
||||
|
||||
//Branch the decoding
|
||||
#define BOOST_TYPEOF_TYPEDEF_DECODED_TYPE(Name,Params)\
|
||||
BOOST_PP_IF(BOOST_TYPEOF_HAS_TEMPLATES(Params),\
|
||||
BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TEMPLATE_TYPE,\
|
||||
BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TYPE)(Name,Params)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_IMPL(Name, Params, Size, ID)\
|
||||
namespace boost{namespace type_of{namespace{\
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE_TEMPLATE_IMPL(Name, Params, ID)\
|
||||
template<class V\
|
||||
BOOST_TYPEOF_SEQ_ENUM_TRAILING(Params, BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_PAIR)\
|
||||
>\
|
||||
struct encode_type_impl<V, Name<BOOST_PP_ENUM_PARAMS(Size, P)> >\
|
||||
{\
|
||||
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;\
|
||||
};\
|
||||
template<class Iter>\
|
||||
struct decode_type_impl<boost::mpl::size_t<ID>, Iter>\
|
||||
{\
|
||||
typedef Iter iter0;\
|
||||
BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM, ~, Params)\
|
||||
BOOST_TYPEOF_TYPEDEF_DECODED_TYPE(Name, Params)\
|
||||
typedef BOOST_PP_CAT(iter, Size) iter;\
|
||||
};\
|
||||
}}}
|
||||
|
||||
#endif//BOOST_TYPEOF_TEMPLATE_ENCODING_HPP_INCLUDED
|
||||
|
@@ -3,8 +3,8 @@
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
#ifndef BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
|
||||
#include <boost/preprocessor/logical/or.hpp>
|
||||
#include <boost/preprocessor/seq/fold_left.hpp>
|
||||
@@ -123,4 +123,4 @@ namespace boost
|
||||
BOOST_TYPEOF_REGISTER_NOTHING,\
|
||||
BOOST_TYPEOF_REGISTER_TYPE_FOR_TEMPLATE_TEMPLATE)(Name,Params,ID)
|
||||
|
||||
#endif //BOOST_TYPEOF_COMPLIANT_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
#endif //BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED
|
6
include/boost/typeof/compliant/type_encoding.hpp → include/boost/typeof/type_encoding.hpp
Executable file → Normal file
6
include/boost/typeof/compliant/type_encoding.hpp → include/boost/typeof/type_encoding.hpp
Executable file → Normal file
@@ -2,8 +2,8 @@
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_TYPE_ENCODING_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_TYPE_ENCODING_HPP_INCLUDED
|
||||
#ifndef BOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TYPE_IMPL(T, Id) \
|
||||
\
|
||||
@@ -21,4 +21,4 @@
|
||||
BOOST_TYPEOF_REGISTER_TYPE_IMPL(Type, BOOST_TYPEOF_UNIQUE_ID()) \
|
||||
}}}
|
||||
|
||||
#endif//BOOST_TYPEOF_COMPLIANT_TYPE_ENCODING_HPP_INCLUDED
|
||||
#endif//BOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED
|
@@ -16,4 +16,22 @@
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_EXPANDTYPE(Param) class
|
||||
|
||||
// TYPE_PARAM "virtual functions" implementation
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_ENCODE(This, n)\
|
||||
typedef typename encode_type<\
|
||||
BOOST_PP_CAT(V, n),\
|
||||
BOOST_PP_CAT(P, n)\
|
||||
>::type BOOST_PP_CAT(V, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_DECODE(This, n)\
|
||||
typedef decode_type< BOOST_PP_CAT(iter, n) > BOOST_PP_CAT(d, n);\
|
||||
typedef typename BOOST_PP_CAT(d, n)::type BOOST_PP_CAT(P, n);\
|
||||
typedef typename BOOST_PP_CAT(d, n)::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_PLACEHOLDER(Param) int
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_DECLARATION_TYPE(Param) class
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_PLACEHOLDER_TYPES(Param, n) BOOST_PP_CAT(T,n)
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_ISTEMPLATE 0
|
||||
|
||||
#endif//BOOST_TYPEOF_TYPE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
|
@@ -23,12 +23,7 @@
|
||||
#elif defined(BOOST_TYPEOF_COMPLIANT)
|
||||
# define BOOST_TYPEOF_TEXT "using compliant imlementation"
|
||||
# include <boost/typeof/message.hpp>
|
||||
# include <boost/typeof/compliant/typeof_impl.hpp>
|
||||
|
||||
#elif defined(BOOST_TYPEOF_VINTAGE)
|
||||
# define BOOST_TYPEOF_TEXT "using vintage imlementation"
|
||||
# include <boost/typeof/message.hpp>
|
||||
# include <boost/typeof/vintage/typeof_impl.hpp>
|
||||
# include <boost/typeof/typeof_impl.hpp>
|
||||
|
||||
#else//BOOST_TYPEOF_NATIVE
|
||||
|
||||
@@ -45,21 +40,14 @@
|
||||
|
||||
// lvalue typeof
|
||||
|
||||
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
# include <boost/typeof/vintage/lvalue_typeof.hpp>
|
||||
#else
|
||||
# include <boost/typeof/compliant/lvalue_typeof.hpp>
|
||||
#endif
|
||||
# include <boost/typeof/lvalue_typeof.hpp>
|
||||
|
||||
// type/template encoding
|
||||
|
||||
#if defined(BOOST_TYPEOF_COMPLIANT)
|
||||
# include <boost/typeof/compliant/type_encoding.hpp>
|
||||
# include <boost/typeof/compliant/template_encoding.hpp>
|
||||
#elif defined(BOOST_TYPEOF_VINTAGE)
|
||||
# include <boost/typeof/vintage/type_encoding.hpp>
|
||||
# include <boost/typeof/vintage/template_encoding.hpp>
|
||||
#else//BOOST_TYPEOF_NATIVE and BOOST_TYPEOF_MSVC
|
||||
# include <boost/typeof/type_encoding.hpp>
|
||||
# include <boost/typeof/template_encoding.hpp>
|
||||
#else //BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_REGISTER_TYPE(x)
|
||||
# define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)
|
||||
#endif
|
||||
@@ -75,17 +63,12 @@
|
||||
|
||||
#if defined(BOOST_TYPEOF_COMPLIANT)
|
||||
|
||||
# include <boost/typeof/compliant/modifiers.hpp>
|
||||
# include <boost/typeof/compliant/pointers_data_members.hpp>
|
||||
# define BOOST_PP_FILENAME_1 <boost/typeof/compliant/register_functions_iterate.hpp>
|
||||
# include <boost/typeof/modifiers.hpp>
|
||||
# include <boost/typeof/pointers_data_members.hpp>
|
||||
# include <boost/typeof/register_functions.hpp>
|
||||
|
||||
#elif defined(BOOST_TYPEOF_VINTAGE)
|
||||
# include <boost/typeof/vintage/modifiers.hpp>
|
||||
# include <boost/typeof/vintage/pointers_data_members.hpp>
|
||||
# define BOOST_PP_FILENAME_1 <boost/typeof/vintage/register_functions_iterate.hpp>
|
||||
# include <boost/typeof/register_functions.hpp>
|
||||
#else //BOOST_TYPEOF_NATIVE
|
||||
|
||||
#endif
|
||||
|
||||
#endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
|
||||
|
10
include/boost/typeof/compliant/typeof_impl.hpp → include/boost/typeof/typeof_impl.hpp
Executable file → Normal file
10
include/boost/typeof/compliant/typeof_impl.hpp → include/boost/typeof/typeof_impl.hpp
Executable file → Normal file
@@ -2,12 +2,12 @@
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_COMPLIANT_TYPEOF_IMPL_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_COMPLIANT_TYPEOF_IMPL_HPP_INCLUDED
|
||||
#ifndef BOOST_TYPEOF_TYPEOF_IMPL_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TYPEOF_IMPL_HPP_INCLUDED
|
||||
|
||||
#include <boost/mpl/size_t.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/typeof/compliant/encode_decode.hpp>
|
||||
#include <boost/typeof/encode_decode.hpp>
|
||||
|
||||
#ifdef BOOST_TYPEOF_USE_MPL_VECTOR
|
||||
# include <boost/mpl/vector.hpp>
|
||||
@@ -15,10 +15,10 @@
|
||||
# include <boost/mpl/at.hpp>
|
||||
# include <boost/mpl/begin_end.hpp>
|
||||
# include <boost/mpl/push_back.hpp>
|
||||
# include <boost/typeof/compliant/limit_size.hpp>
|
||||
# include <boost/typeof/limit_size.hpp>
|
||||
# define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::mpl::vector, n)
|
||||
#else
|
||||
# include <boost/typeof/compliant/vector.hpp>
|
||||
# include <boost/typeof/vector.hpp>
|
||||
# define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::type_of::vector, n)
|
||||
#endif
|
||||
|
4
include/boost/typeof/compliant/vector.hpp → include/boost/typeof/vector.hpp
Executable file → Normal file
4
include/boost/typeof/compliant/vector.hpp → include/boost/typeof/vector.hpp
Executable file → Normal file
@@ -6,8 +6,8 @@
|
||||
// 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
|
||||
#ifndef BOOST_TYPEOF_VECTOR_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VECTOR_HPP_INCLUDED
|
||||
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/deref.hpp>
|
@@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_CONCATENATE_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_CONCATENATE_HPP_INCLUDED
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/typeof/vintage/type_list.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
// Assumes iter0 contains initial iterator
|
||||
|
||||
#define BOOST_TYPEOF_DECODE_PARAM(z, n, text) \
|
||||
typedef decode_impl<TYPEOF_GET_VALUE(iter##n)>::decoder<TYPEOF_GET_NEXT(iter##n)> decode##n;\
|
||||
typedef typename decode##n::type P##n; \
|
||||
typedef typename decode##n::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_DECODE_PARAMS(n)\
|
||||
BOOST_PP_REPEAT(n, BOOST_TYPEOF_DECODE_PARAM, _);
|
||||
|
||||
#define BOOST_TYPEOF_PUSH_FRONT(z,n,template_size)\
|
||||
typedef type_list<\
|
||||
BOOST_PP_CAT(P,BOOST_PP_DEC(BOOST_PP_SUB(template_size,n))),\
|
||||
BOOST_PP_CAT(types_,BOOST_PP_SUB(template_size,n))\
|
||||
> BOOST_PP_CAT(types_,BOOST_PP_DEC(BOOST_PP_SUB(template_size,n)));
|
||||
|
||||
#endif//BOOST_TYPEOF_CONCATENATE_HPP_INCLUDED
|
@@ -1,75 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_CONFIG_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_CONFIG_HPP_INCLUDED
|
||||
|
||||
#ifndef BOOST_MAX_TYPEOF_COUNTER
|
||||
#define BOOST_MAX_TYPEOF_COUNTER 1000
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
# define BOOST_MIN_TYPEOF_COUNTER 5
|
||||
#else
|
||||
# define BOOST_MIN_TYPEOF_COUNTER 1
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
#define TYPEOF_MSVC_ETI_WRAPPER(name) \
|
||||
namespace boost { namespace type_of { namespace detail \
|
||||
{ \
|
||||
template <typename T> \
|
||||
struct BOOST_PP_CAT(get_, name) \
|
||||
{ \
|
||||
typedef typename T::name type; \
|
||||
}; \
|
||||
\
|
||||
template <> \
|
||||
struct BOOST_PP_CAT(get_, name)<int> \
|
||||
{ \
|
||||
typedef int type; \
|
||||
}; \
|
||||
}}}
|
||||
#endif //BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
TYPEOF_MSVC_ETI_WRAPPER(next)
|
||||
# define TYPEOF_GET_NEXT(T) ::boost::type_of::detail::get_next<T>::type
|
||||
#else
|
||||
# define TYPEOF_GET_NEXT(T) typename T::next
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) \
|
||||
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
namespace boost { namespace type_of { namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
struct get_value
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, value = T::value);
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
|
||||
// VC6 ETI (early template instantiation) bug workaround.
|
||||
template <>
|
||||
struct get_value<int>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
#endif
|
||||
}}}
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) \
|
||||
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
# define TYPEOF_GET_VALUE(T) ::boost::type_of::detail::get_value<T>::value
|
||||
#else
|
||||
# define TYPEOF_GET_VALUE(T) T::value
|
||||
#endif
|
||||
|
||||
#endif //BOOST_TYPEOF_VINTAGE_CONFIG_HPP_INCLUDED
|
@@ -1,50 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_ENCODE_DECODE_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_ENCODE_DECODE_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TYPEOF_UNIQUE_ID()\
|
||||
BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__
|
||||
|
||||
#define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
|
||||
<boost/typeof/increment_registration_group.hpp>
|
||||
|
||||
#include <boost/typeof/vintage/modifier_category.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace type_of
|
||||
{
|
||||
template<unsigned N>
|
||||
struct encode_impl {
|
||||
template<typename V,typename T,typename Types>
|
||||
struct encoder {
|
||||
};
|
||||
};
|
||||
template<int>
|
||||
struct decode_impl{
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
typedef int type;
|
||||
typedef int iter;
|
||||
};
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,<=1300)
|
||||
template<>
|
||||
struct decoder<int> {
|
||||
typedef int type;
|
||||
typedef int iter;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename V,typename T,typename Types>
|
||||
struct encode_modifier {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=modifier_category<T>::value);
|
||||
typedef typename encode_impl<value>::template encoder<V,T,Types> encoded_type;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif//BOOST_TYPEOF_VINTAGE_ENCODE_DECODE_HPP_INCLUDED
|
@@ -1,91 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_INT_ENCODING_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTATE_INT_ENCODING_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost {namespace type_of {
|
||||
|
||||
template<unsigned N>
|
||||
struct integral_wrapper {};
|
||||
|
||||
template<unsigned N>
|
||||
struct encode_integral {
|
||||
template<typename V,typename Types>
|
||||
struct encoder {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(typename encode_modifier<typename mpl::next<V>::type,typename Types::type,typename Types::next>::encoded_type));
|
||||
|
||||
friend sizer<N^0x80000000> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
};
|
||||
};
|
||||
//Special implementation for 0x80000000 and 0x7FFFFFFF in order to allow representation of all numbers
|
||||
template<>
|
||||
struct encode_integral<0x80000000>
|
||||
{
|
||||
template<typename V,typename Types>
|
||||
struct encoder {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(typename encode_modifier<typename mpl::next<typename mpl::next<V>::type>::type,typename Types::type,typename Types::next>::encoded_type));
|
||||
|
||||
friend sizer<0xFFFFFFFF> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
friend sizer<0x80000000> encode_value(const sizer<V::index>&,const sizer<(V::pos)+1>&);
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct encode_integral<0x7FFFFFFF>
|
||||
{
|
||||
template<typename V,typename Types>
|
||||
struct encoder {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(typename encode_modifier<typename mpl::next<typename mpl::next<V>::type>::type,typename Types::type,typename Types::next>::encoded_type));
|
||||
|
||||
friend sizer<0xFFFFFFFF> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
friend sizer<0x7FFFFFFF> encode_value(const sizer<V::index>&,const sizer<(V::pos)+1>&);
|
||||
};
|
||||
};
|
||||
|
||||
template<unsigned N,typename V,typename Types>
|
||||
encode_integral<N>::encoder<V,Types> encode(integral_wrapper<N> const&(*)(V,Types));
|
||||
|
||||
template<unsigned N>
|
||||
struct decode_integral_base {
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
BOOST_STATIC_CONSTANT(int,value=N^0x80000000);
|
||||
typedef Iter iter;
|
||||
};
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,<=1300)
|
||||
template<>
|
||||
struct decoder<int> {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=1);
|
||||
typedef int iter;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decode_integral_base<0xFFFFFFFF> {
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
BOOST_STATIC_CONSTANT(int,value=Iter::value);
|
||||
typedef typename Iter::next iter;
|
||||
};
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,<=1300)
|
||||
template<>
|
||||
struct decoder<int> {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=1);
|
||||
typedef int iter;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename Iter>
|
||||
struct decode_integral : decode_integral_base<TYPEOF_GET_VALUE(Iter)>::decoder<TYPEOF_GET_NEXT(Iter)>
|
||||
{
|
||||
};
|
||||
|
||||
}}//namespace boost::type_of
|
||||
|
||||
#endif //BOOST_TYPEOF_INTEGRAL_WRAPPER_HPP_HOLT_2004_0818
|
@@ -1,54 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_IS_POINTER_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_IS_POINTER_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
template<typename T>
|
||||
boost::detail::yes_type is_pointer_tester(T*);
|
||||
boost::detail::no_type is_pointer_tester(...);
|
||||
|
||||
template <bool>
|
||||
struct is_pointer_select
|
||||
: ::boost::type_traits::false_result
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_pointer_select<false>
|
||||
{
|
||||
template <typename T> struct result_
|
||||
{
|
||||
static T& make_t();
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(1 == sizeof(is_pointer_tester(make_t())))
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_pointer_impl
|
||||
: is_pointer_select<
|
||||
::boost::type_traits::ice_or<
|
||||
::boost::is_reference<T>::value
|
||||
, ::boost::is_array<T>::value
|
||||
>::value
|
||||
>::template result_<T>
|
||||
{
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_pointer : is_pointer_impl<T>
|
||||
{};
|
||||
|
||||
template<>
|
||||
struct is_pointer<void> : ::boost::mpl::false_
|
||||
{};
|
||||
}}//namespace boost::type_of
|
||||
|
||||
#endif //BOOST_TYPEOF_VINTAGE_IS_POINTER_HPP_INCLUDED
|
@@ -1,38 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
template<>
|
||||
struct encode_impl<ARRAY_ID+n>
|
||||
{
|
||||
template<typename V,typename T,typename Types>
|
||||
struct encoder {
|
||||
BOOST_STATIC_CONSTANT(unsigned,size=(sizeof(*((T*)NULL))/sizeof((*((T*)NULL))[0])));
|
||||
typedef typename mpl::next<typename mpl::next<V>::type>::type next_type;
|
||||
typedef void(*function_ptr)(
|
||||
sizer<ARRAY_ID+n>,
|
||||
next_type,
|
||||
T,
|
||||
Types
|
||||
);
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL))));
|
||||
|
||||
friend sizer<ARRAY_ID+n> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
friend sizer<size> encode_value(const sizer<V::index>&,const sizer<(V::pos)+1>&);
|
||||
};
|
||||
};
|
||||
template<typename V,typename T,typename Types>
|
||||
typename encode_modifier<V,T,Types>::encoded_type encode(void(*)(sizer<ARRAY_ID+n>,V,T BOOST_TYPEOF_qualifier[],Types));
|
||||
|
||||
template<>
|
||||
struct decode_impl<ARRAY_ID+n>
|
||||
{
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
BOOST_STATIC_CONSTANT(unsigned,size=Iter::value);
|
||||
typedef typename Iter::next iter1;
|
||||
typedef typename decode_impl<iter1::value>::decoder<iter1::next> decode1;
|
||||
typedef typename decode1::type BOOST_TYPEOF_qualifier type[size];
|
||||
typedef typename decode1::iter iter;
|
||||
};
|
||||
};
|
@@ -1,121 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_MODIFIER_CATEGORY_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_MODIFIER_CATEGORY_HPP_INCLUDED
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_volatile.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/is_member_pointer.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/typeof/vintage/is_pointer.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
enum {
|
||||
FUNCTION_OR_MEMBER_ID=BOOST_TYPEOF_UNIQUE_ID(),
|
||||
VOID_ID,
|
||||
NO_MODIFIERS,
|
||||
CONST_ID,
|
||||
VOLATILE_ID,
|
||||
CV_ID,
|
||||
POINTER_ID,
|
||||
CONST_POINTER_ID,
|
||||
VOLATILE_POINTER_ID,
|
||||
CV_POINTER_ID,
|
||||
REFERENCE_ID,
|
||||
CONST_REFERENCE_ID,
|
||||
VOLATILE_REFERENCE_ID,
|
||||
CV_REFERENCE_ID,
|
||||
ARRAY_ID,
|
||||
CONST_ARRAY_ID,
|
||||
VOLATILE_ARRAY_ID,
|
||||
CV_ARRAY_ID,
|
||||
MEMBER_POINTER_ID,
|
||||
};
|
||||
|
||||
template<typename U,int N>
|
||||
struct cv_type {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=(N+is_const<U>::value+is_volatile<U>::value*2));
|
||||
};
|
||||
|
||||
template<int Indirection>
|
||||
struct indirection {
|
||||
template<typename T>
|
||||
struct inner {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=Indirection);
|
||||
};
|
||||
};
|
||||
|
||||
template<>//pointer
|
||||
struct indirection<POINTER_ID> {
|
||||
template<typename T>
|
||||
struct inner {
|
||||
template<typename U>
|
||||
static char (*test(U*))[cv_type<U,POINTER_ID>::value];
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(*test((T)NULL) ));
|
||||
};
|
||||
};
|
||||
|
||||
template<>//reference
|
||||
struct indirection<REFERENCE_ID> {
|
||||
template<typename T>
|
||||
struct inner {
|
||||
static T (*function)();
|
||||
|
||||
template<typename U>
|
||||
static char (*test(U& (*)()))[cv_type<U,REFERENCE_ID>::value];
|
||||
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(*test(function)));
|
||||
};
|
||||
};
|
||||
|
||||
template<>//array
|
||||
struct indirection<ARRAY_ID> {
|
||||
template<typename T>
|
||||
struct inner {
|
||||
template<typename U>
|
||||
static char (*test(U []))[cv_type<U,ARRAY_ID>::value];
|
||||
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(*test(*((T*)NULL)) ));
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct modifier_category {
|
||||
template<int cv>
|
||||
struct inner {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=NO_MODIFIERS+cv);
|
||||
};
|
||||
template<>
|
||||
struct inner<0> {
|
||||
BOOST_STATIC_CONSTANT(int,indir= (
|
||||
//boost::is_function<T>::value?FUNCTION_OR_MEMBER_ID:
|
||||
boost::is_array<T>::value?ARRAY_ID:
|
||||
boost::type_of::is_pointer<T>::value?POINTER_ID:
|
||||
boost::is_reference<T>::value?REFERENCE_ID:
|
||||
NO_MODIFIERS
|
||||
));
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=indirection<indir>::inner<T>::value);
|
||||
};
|
||||
|
||||
BOOST_STATIC_CONSTANT(unsigned,cv=boost::is_array<T>::value?0:boost::is_const<T>::value+boost::is_volatile<T>::value*2);
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=inner<cv>::value);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct modifier_category<void>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=VOID_ID);
|
||||
};
|
||||
|
||||
}} //namespace boost::type_of
|
||||
|
||||
#endif //BOOST_TYPEOF_VINTAGE_MODIFIER_CATEGORY_HPP_INCLUDED
|
||||
|
@@ -1,34 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
template<>
|
||||
struct encode_impl<POINTER_ID+n>
|
||||
{
|
||||
template<typename V,typename T,typename Types>
|
||||
struct encoder {
|
||||
typedef void(*function_ptr)(
|
||||
sizer<POINTER_ID+n>,
|
||||
typename mpl::next<V>::type,
|
||||
T,
|
||||
Types
|
||||
);
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL))));
|
||||
|
||||
friend sizer<POINTER_ID+n> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
};
|
||||
};
|
||||
|
||||
template<typename V,typename T,typename Types>
|
||||
typename encode_modifier<V,T,Types>::encoded_type encode(void(*)(sizer<POINTER_ID+n>,V,T BOOST_TYPEOF_qualifier *,Types));
|
||||
|
||||
template<>
|
||||
struct decode_impl<POINTER_ID+n>
|
||||
{
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
typedef typename decode_impl<Iter::value>::decoder<Iter::next> decode0;
|
||||
typedef typename decode0::type BOOST_TYPEOF_qualifier * type;
|
||||
typedef typename decode0::iter iter;
|
||||
};
|
||||
};
|
@@ -1,34 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
template<>
|
||||
struct encode_impl<NO_MODIFIERS+n>
|
||||
{
|
||||
template<typename V,typename T,typename Types>
|
||||
struct encoder {
|
||||
typedef void(*function_ptr)(
|
||||
sizer<NO_MODIFIERS+n>,
|
||||
typename mpl::next<V>::type,
|
||||
T*,
|
||||
Types
|
||||
);
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL))));
|
||||
|
||||
friend sizer<NO_MODIFIERS+n> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
};
|
||||
};
|
||||
|
||||
template<typename V,typename T,typename Types>
|
||||
typename encode_modifier<V,T,Types>::encoded_type encode(void(*)(sizer<NO_MODIFIERS+n>,V,T BOOST_TYPEOF_qualifier *,Types));
|
||||
|
||||
template<>
|
||||
struct decode_impl<NO_MODIFIERS+n>
|
||||
{
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
typedef typename decode_impl<Iter::value>::decoder<Iter::next> decode0;
|
||||
typedef typename decode0::type BOOST_TYPEOF_qualifier type;
|
||||
typedef typename decode0::iter iter;
|
||||
};
|
||||
};
|
@@ -1,33 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
template<>
|
||||
struct encode_impl<REFERENCE_ID+n>
|
||||
{
|
||||
template<typename V,typename T,typename Types>
|
||||
struct encoder {
|
||||
typedef T(*function_ptr)(
|
||||
sizer<REFERENCE_ID+n>,
|
||||
typename mpl::next<V>::type,
|
||||
Types
|
||||
);
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL))));
|
||||
|
||||
friend sizer<REFERENCE_ID+n> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
};
|
||||
};
|
||||
|
||||
template<typename V,typename T,typename Types>
|
||||
typename encode_modifier<V,T,Types>::encoded_type encode(T BOOST_TYPEOF_qualifier& (*)(sizer<REFERENCE_ID+n>,V,Types));
|
||||
|
||||
template<>
|
||||
struct decode_impl<REFERENCE_ID+n>
|
||||
{
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
typedef typename decode_impl<Iter::value>::decoder<Iter::next> decode0;
|
||||
typedef typename decode0::type BOOST_TYPEOF_qualifier & type;
|
||||
typedef typename decode0::iter iter;
|
||||
};
|
||||
};
|
@@ -1,122 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_VINTAGE_TYPEOF_MODIFIERS_HPP_INCLUDED
|
||||
#define BOOST_VINTAGE_TYPEOF_MODIFIERS_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/vintage/type_list.hpp>
|
||||
#include <boost/typeof/vintage/encode_decode.hpp>
|
||||
#include <boost/mpl/next.hpp>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
sizer<0xffff> encode(...);
|
||||
template<unsigned N>
|
||||
struct validate_type {
|
||||
template<typename T>
|
||||
struct Type_Not_Registered_With_Typeof_System {
|
||||
typedef int type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct validate_type<0xffff> {
|
||||
template<typename T>
|
||||
struct Type_Not_Registered_With_Typeof_System {
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct encode_impl<NO_MODIFIERS>
|
||||
{
|
||||
template<typename V,typename T,typename Types>
|
||||
struct encoder {
|
||||
typedef T const& (*function_ptr)(V,Types);
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL))));
|
||||
/*
|
||||
If T is a simple type, use BOOST_TYPEOF_REGISTER_TYPE
|
||||
if T is a simple template type (containing only typenames) use BOOST_TYPEOF_REGISTER_TEMPLATE
|
||||
If T is a complex template type (containing integral constants) use BOOST_TYPEOF_REGISTER_TEMPLATE_X
|
||||
If T is a nested class, you need to use BOOST_TYPEOF_REGISTER_TYPE for every concrete instantiation of that class.
|
||||
*/
|
||||
typedef validate_type<value>::Type_Not_Registered_With_Typeof_System<T>::type type_validation;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct encode_impl<FUNCTION_OR_MEMBER_ID>
|
||||
{
|
||||
template<typename V,typename T,typename Types>
|
||||
struct encoder {
|
||||
typedef T& (*function_ptr)(V,Types);
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=sizeof(encode(function_ptr(NULL))));
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct encode_impl<VOID_ID>
|
||||
{
|
||||
template<typename V,typename T,typename Types>
|
||||
struct encoder {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=
|
||||
sizeof(
|
||||
typename encode_modifier<
|
||||
typename mpl::next<V>::type,
|
||||
typename Types::type,
|
||||
typename Types::next
|
||||
>::encoded_type
|
||||
)
|
||||
);
|
||||
friend sizer<VOID_ID> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decode_impl<VOID_ID>
|
||||
{
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
typedef void type;
|
||||
typedef Iter iter;
|
||||
};
|
||||
};
|
||||
|
||||
#define BOOST_TYPEOF_qualifier
|
||||
#define n 0
|
||||
#include <boost/typeof/vintage/modifier_pointer.hpp>
|
||||
#include <boost/typeof/vintage/modifier_reference.hpp>
|
||||
#include <boost/typeof/vintage/modifier_array.hpp>
|
||||
#undef n
|
||||
#undef BOOST_TYPEOF_qualifier
|
||||
|
||||
#define BOOST_TYPEOF_qualifier const
|
||||
#define n 1
|
||||
#include <boost/typeof/vintage/modifier_qualifier.hpp>
|
||||
#include <boost/typeof/vintage/modifier_pointer.hpp>
|
||||
#include <boost/typeof/vintage/modifier_reference.hpp>
|
||||
#include <boost/typeof/vintage/modifier_array.hpp>
|
||||
#undef n
|
||||
#undef BOOST_TYPEOF_qualifier
|
||||
|
||||
#define BOOST_TYPEOF_qualifier volatile
|
||||
#define n 2
|
||||
#include <boost/typeof/vintage/modifier_qualifier.hpp>
|
||||
#include <boost/typeof/vintage/modifier_pointer.hpp>
|
||||
#include <boost/typeof/vintage/modifier_reference.hpp>
|
||||
#include <boost/typeof/vintage/modifier_array.hpp>
|
||||
#undef n
|
||||
#undef BOOST_TYPEOF_qualifier
|
||||
|
||||
#define BOOST_TYPEOF_qualifier const volatile
|
||||
#define n 3
|
||||
#include <boost/typeof/vintage/modifier_qualifier.hpp>
|
||||
#include <boost/typeof/vintage/modifier_pointer.hpp>
|
||||
#include <boost/typeof/vintage/modifier_reference.hpp>
|
||||
#include <boost/typeof/vintage/modifier_array.hpp>
|
||||
#undef n
|
||||
#undef BOOST_TYPEOF_qualifier
|
||||
|
||||
}} //namespace boost::type_of
|
||||
|
||||
#endif //BOOST_VINTAGE_TYPEOF_MODIFIERS_HPP_INCLUDED
|
@@ -1,59 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_POINTERS_DATA_MEMBERS_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_POINTERS_DATA_MEMBERS_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/config.hpp>
|
||||
#include <boost/typeof/vintage/concatenate.hpp>
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
namespace boost { namespace type_of{
|
||||
enum {PTR_DATA_MEM_ID = BOOST_TYPEOF_UNIQUE_ID()};
|
||||
|
||||
template<>
|
||||
struct encode_impl<PTR_DATA_MEM_ID>
|
||||
{
|
||||
template<typename V,typename R,typename T,typename Types>
|
||||
struct encoder {
|
||||
typedef Types types_2;
|
||||
typedef type_list< T, types_2 > types_1;
|
||||
typedef type_list< R, types_1 > types_0;
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=
|
||||
sizeof(
|
||||
typename encode_modifier<
|
||||
typename mpl::next<V>::type,
|
||||
typename types_0::type,
|
||||
types_1
|
||||
>::encoded_type
|
||||
)
|
||||
);
|
||||
friend sizer<PTR_DATA_MEM_ID> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
};
|
||||
};
|
||||
template<typename R,typename T,typename V,typename Types>
|
||||
typename encode_impl<PTR_DATA_MEM_ID>::template encoder<V,R,T,Types>
|
||||
encode(R (T::* const&(*function)(V,Types)));
|
||||
|
||||
template<> struct decode_impl<PTR_DATA_MEM_ID> {
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(2)
|
||||
|
||||
template<typename R,typename T> struct workaround{
|
||||
typedef R (T::*type);
|
||||
};
|
||||
template<> struct workaround<int,int>{
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
typedef workaround<P0,P1>::type type;
|
||||
typedef iter2 iter;
|
||||
};
|
||||
};
|
||||
}} //namespace boost::type_of
|
||||
|
||||
#endif //BOOST_TYPEOF_REGISTER_MEMBER_POINTER_HPP_HOLT_2004_1015
|
@@ -1,105 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define n BOOST_PP_ITERATION()
|
||||
|
||||
template<>
|
||||
struct encode_impl<FUN_REF_ID + n>
|
||||
{
|
||||
template<typename V,typename R BOOST_PP_ENUM_TRAILING_PARAMS(n,typename P),typename Types>
|
||||
struct encoder {
|
||||
typedef Types BOOST_PP_CAT(types_,n);
|
||||
BOOST_PP_REPEAT(n,BOOST_TYPEOF_PUSH_FRONT,n)
|
||||
BOOST_STATIC_CONSTANT(int,instantiate =
|
||||
sizeof(
|
||||
encode_modifier<
|
||||
mpl::next<V>::type,
|
||||
R,
|
||||
types_0
|
||||
>::encoded_type
|
||||
)
|
||||
);
|
||||
friend sizer<FUN_REF_ID + n> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
};
|
||||
};
|
||||
|
||||
template<typename V,typename R BOOST_PP_ENUM_TRAILING_PARAMS(n,typename P),typename Types>
|
||||
typename encode_impl<FUN_REF_ID + n>::template encoder<V,R BOOST_PP_ENUM_TRAILING_PARAMS(n,P),Types>
|
||||
encode(R (& (*function)(V,Types))(BOOST_PP_ENUM_PARAMS(n,P)) );
|
||||
|
||||
template<>
|
||||
struct decode_impl<FUN_REF_ID + n>
|
||||
{
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
typedef Iter iterR;
|
||||
typedef decode_impl<TYPEOF_GET_VALUE(iterR)>::decoder<TYPEOF_GET_NEXT(iterR)> decodeR;
|
||||
typedef typename decodeR::type R;
|
||||
typedef typename decodeR::iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(n);
|
||||
typedef R (&type)(BOOST_PP_ENUM_PARAMS(n,P));
|
||||
typedef BOOST_PP_CAT(iter,n) iter;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct encode_impl<FUN_ID + n>
|
||||
{
|
||||
template<typename V,typename R BOOST_PP_ENUM_TRAILING_PARAMS(n,typename P),typename Types>
|
||||
struct encoder {
|
||||
typedef Types BOOST_PP_CAT(types_,n);
|
||||
BOOST_PP_REPEAT(n,BOOST_TYPEOF_PUSH_FRONT,n)
|
||||
BOOST_STATIC_CONSTANT(int,instantiate =
|
||||
sizeof(
|
||||
encode_modifier<
|
||||
mpl::next<V>::type,
|
||||
R,
|
||||
types_0
|
||||
>::encoded_type
|
||||
)
|
||||
);
|
||||
friend sizer<FUN_ID + n> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
};
|
||||
};
|
||||
|
||||
template<typename V,typename R BOOST_PP_ENUM_TRAILING_PARAMS(n,typename P),typename Types>
|
||||
typename encode_impl<FUN_ID + n>::template encoder<V,R BOOST_PP_ENUM_TRAILING_PARAMS(n,P),Types>
|
||||
encode(R (* const& (*function)(V,Types))(BOOST_PP_ENUM_PARAMS(n,P)) );
|
||||
|
||||
template<>
|
||||
struct decode_impl<FUN_ID + n>
|
||||
{
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
typedef Iter iterR;
|
||||
typedef decode_impl<TYPEOF_GET_VALUE(iterR)>::decoder<TYPEOF_GET_NEXT(iterR)> decodeR;
|
||||
typedef typename decodeR::type R;
|
||||
typedef typename decodeR::iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(n);
|
||||
typedef R (*type)(BOOST_PP_ENUM_PARAMS(n,P));
|
||||
typedef BOOST_PP_CAT(iter,n) iter;
|
||||
};
|
||||
};
|
||||
|
||||
#define BOOST_TYPEOF_qualifier
|
||||
#define BOOST_TYPEOF_id MEM_FUN_ID
|
||||
|
||||
#include <boost/typeof/vintage/register_mem_functions.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_qualifier const
|
||||
#define BOOST_TYPEOF_id CONST_MEM_FUN_ID
|
||||
|
||||
#include <boost/typeof/vintage/register_mem_functions.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_qualifier volatile
|
||||
#define BOOST_TYPEOF_id VOLATILE_MEM_FUN_ID
|
||||
|
||||
#include <boost/typeof/vintage/register_mem_functions.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_qualifier volatile const
|
||||
#define BOOST_TYPEOF_id VOLATILE_CONST_MEM_FUN_ID
|
||||
|
||||
#include <boost/typeof/vintage/register_mem_functions.hpp>
|
||||
|
||||
#undef n
|
@@ -1,59 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
//member functions
|
||||
//This file must not be included directly.
|
||||
|
||||
template<>
|
||||
struct encode_impl<BOOST_TYPEOF_id + n>
|
||||
{
|
||||
template<typename V,typename R,typename T BOOST_PP_ENUM_TRAILING_PARAMS(n,typename P),typename Types>
|
||||
struct encoder {
|
||||
typedef Types BOOST_PP_CAT(types_,n);
|
||||
BOOST_PP_REPEAT(n,BOOST_TYPEOF_PUSH_FRONT,n)
|
||||
BOOST_STATIC_CONSTANT(int,instantiate =
|
||||
sizeof(
|
||||
encode_modifier<
|
||||
mpl::next<V>::type,
|
||||
R,
|
||||
type_list<T,types_0>
|
||||
>::encoded_type
|
||||
)
|
||||
);
|
||||
friend sizer<BOOST_TYPEOF_id + n> encode_value(const sizer<V::index>&,const sizer<V::pos>&);
|
||||
};
|
||||
};
|
||||
|
||||
template<typename V,typename R,typename T BOOST_PP_ENUM_TRAILING_PARAMS(n,typename P),typename Types>
|
||||
typename encode_impl<BOOST_TYPEOF_id + n>::template encoder<V,R,T BOOST_PP_ENUM_TRAILING_PARAMS(n,P),Types>
|
||||
encode(R (T::* const&(*function)(V,Types))(BOOST_PP_ENUM_PARAMS(n,P)) BOOST_TYPEOF_qualifier);
|
||||
|
||||
template<>
|
||||
struct decode_impl<BOOST_TYPEOF_id + n>
|
||||
{
|
||||
template<typename Iter>
|
||||
struct decoder {
|
||||
typedef Iter iterR;
|
||||
typedef decode_impl<TYPEOF_GET_VALUE(iterR)>::decoder<TYPEOF_GET_NEXT(iterR)> decodeR;\
|
||||
typedef typename decodeR::type R;
|
||||
typedef typename decodeR::iter iterT;
|
||||
typedef decode_impl<TYPEOF_GET_VALUE(iterT)>::decoder<TYPEOF_GET_NEXT(iterT)> decodeT;\
|
||||
typedef typename decodeT::type T;
|
||||
typedef typename decodeT::iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(n)
|
||||
template<typename R_,typename T_ BOOST_PP_ENUM_TRAILING_PARAMS(n,typename P_)>
|
||||
struct workaround {
|
||||
typedef R_ (T_::*type)(BOOST_PP_ENUM_PARAMS(n,P_)) BOOST_TYPEOF_qualifier;
|
||||
};
|
||||
template<>
|
||||
struct workaround<int,int BOOST_PP_ENUM_TRAILING_PARAMS(n,int BOOST_PP_INTERCEPT)> {
|
||||
typedef int type;
|
||||
};
|
||||
typedef workaround<R,T BOOST_PP_ENUM_TRAILING_PARAMS(n,P)>::type type;
|
||||
typedef BOOST_PP_CAT(iter,n) iter;
|
||||
};
|
||||
};
|
||||
|
||||
#undef BOOST_TYPEOF_id
|
||||
#undef BOOST_TYPEOF_qualifier
|
@@ -1,101 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_SIZER_HPP_HOLT_2004_0819
|
||||
#define BOOST_TYPEOF_SIZER_HPP_HOLT_2004_0819
|
||||
|
||||
#ifdef BOOST_MAX_RECURSION
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{namespace type_of {
|
||||
|
||||
/*
|
||||
The reason for a sizer class to extract the size of a type from,
|
||||
is that using the size of a function returning an array limits the size of the array to 0x7FFFFFF
|
||||
(At least on VC 6.5) This is ok when representing type identifiers,
|
||||
but not when representing integral types such as mpl::int_<0xFFFFFFFF>.
|
||||
Also, VC 7.0 does not do well with function references returning an array ( char (&f())[N];)
|
||||
sizer can be used to represent any number from 1 to 0xFFFFFFFF.
|
||||
*/
|
||||
template<unsigned S>
|
||||
struct sizer {
|
||||
enum {value1=S/2};
|
||||
enum {value2=S-S/2};
|
||||
char a[value1];
|
||||
char b[value2];
|
||||
};
|
||||
|
||||
template<>
|
||||
struct sizer<1> {
|
||||
char type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct sizer<0xFFFFFFFF> {
|
||||
char a[0x7FFFFFFF];
|
||||
char b[0x7FFFFFFF];
|
||||
char c;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct sizer<0> {
|
||||
//Unable to represent a type with zero size.
|
||||
};
|
||||
|
||||
template<int N> struct encode_counter : encode_counter<N - 1> {};
|
||||
template<> struct encode_counter<0> {};
|
||||
|
||||
#ifdef BOOST_MAX_RECURSION
|
||||
#define BOOST_TYPEOF_SPECIALIZE_ENCODE_COUNTER(z,n,text)\
|
||||
template<> struct encode_counter<BOOST_MAX_RECURSION*BOOST_PP_INC(n)> {};
|
||||
|
||||
BOOST_PP_REPEAT(20,BOOST_TYPEOF_SPECIALIZE_ENCODE_COUNTER,_)
|
||||
#undef BOOST_TYPEOF_SPECIALIZE_ENCODE_COUNTER
|
||||
|
||||
|
||||
template<typename T,int N=BOOST_MAX_RECURSION>
|
||||
struct counter_start
|
||||
{
|
||||
template<bool>
|
||||
struct increase_limit {
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=(counter_start<T,N+BOOST_MAX_RECURSION>::value));
|
||||
};
|
||||
template<>
|
||||
struct increase_limit<false>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=N-1);
|
||||
};
|
||||
BOOST_STATIC_CONSTANT(unsigned,current=N-1);
|
||||
BOOST_STATIC_CONSTANT(unsigned,next=N+BOOST_MAX_RECURSION-1);
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool,exceed_current=(sizeof(encode_index((encode_counter<current>*)NULL))==current));
|
||||
BOOST_STATIC_CONSTANT(bool,start_next=(sizeof(encode_index((encode_counter<next>*)NULL))>1));
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=(increase_limit<exceed_current&&start_next>::value));
|
||||
typedef encode_counter<value> type;
|
||||
};
|
||||
|
||||
#define BOOST_TYPEOF_INDEX(T) (sizeof(boost::type_of::encode_index((boost::type_of::counter_start<T>::type*)0)))
|
||||
#else
|
||||
|
||||
#define BOOST_TYPEOF_INDEX(T) (sizeof(boost::type_of::encode_index((boost::type_of::encode_counter<BOOST_MAX_TYPEOF_COUNTER+BOOST_MIN_TYPEOF_COUNTER>*)0)))
|
||||
|
||||
#endif
|
||||
|
||||
#define BOOST_TYPEOF_VALUE(A,B) (sizeof(boost::type_of::encode_value(A(),B())))
|
||||
|
||||
|
||||
sizer<1> encode_value(...);
|
||||
//Need a large starting value, due to MSVC's ETI errors.
|
||||
sizer<BOOST_MIN_TYPEOF_COUNTER> encode_index(...);
|
||||
/*
|
||||
#define BOOST_TYPEOF_VALUE(N) (sizeof(boost::type_of::encode_value((boost::type_of::encode_counter<N>*)0)))
|
||||
#define BOOST_TYPEOF_INDEX() (sizeof(*boost::type_of::encode_index((boost::type_of::encode_counter<BOOST_MAX_TYPEOF_COUNTER+BOOST_MIN_TYPEOF_COUNTER>*)0)))
|
||||
*/
|
||||
|
||||
}}//namespace boost::type_of
|
||||
|
||||
#endif //BOOST_TYPEOF_SIZER_HPP_HOLT_2004_0819
|
||||
|
@@ -1,122 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_TEMPLATE_ENCODING_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_TEMPLATE_ENCODING_HPP_INCLUDED
|
||||
|
||||
#include <boost/preprocessor/punctuation/paren.hpp>
|
||||
#include <boost/preprocessor/enum.hpp>
|
||||
#include <boost/preprocessor/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
//#include <boost/preprocessor/seq.hpp>
|
||||
|
||||
#include <boost/typeof/config.hpp>
|
||||
#include <boost/typeof/vintage/encode_decode.hpp>
|
||||
#include <boost/typeof/vintage/int_encoding.hpp>
|
||||
#include <boost/typeof/template_encoding.hpp>
|
||||
#include <boost/typeof/type_template_param.hpp>
|
||||
#include <boost/typeof/integral_template_param.hpp>
|
||||
|
||||
//
|
||||
|
||||
#define BOOST_TYPEOF_PARAM_CAST(Param)\
|
||||
BOOST_PP_CAT(BOOST_TYPEOF_CAST_, BOOST_PP_SEQ_ELEM(0, Param))
|
||||
|
||||
//
|
||||
#define BOOST_TYPEOF_PARAM_GETTYPE(obj) BOOST_TYPEOF_VIRTUAL(EXPANDTYPE, obj)(obj)
|
||||
//
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_ENCODE(This, n)\
|
||||
BOOST_PP_CAT(P, n)
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_DECODE(This, n)\
|
||||
typedef typename decode_impl<TYPEOF_GET_VALUE(BOOST_PP_CAT(iter,n))>::\
|
||||
decoder<TYPEOF_GET_NEXT(BOOST_PP_CAT(iter,n))> BOOST_PP_CAT(d,n);\
|
||||
typedef typename BOOST_PP_CAT(d,n)::type BOOST_PP_CAT(P,n);\
|
||||
typedef typename BOOST_PP_CAT(d,n)::iter BOOST_PP_CAT(iter,BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_CAST(This, n)\
|
||||
BOOST_PP_CAT(P,n)
|
||||
|
||||
//
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_ENCODE(This, n)\
|
||||
integral_wrapper<\
|
||||
BOOST_PP_CAT(P, n)\
|
||||
>
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_DECODE(This, n)\
|
||||
typedef decode_integral<BOOST_PP_CAT(iter,n)> BOOST_PP_CAT(d,n);\
|
||||
BOOST_STATIC_CONSTANT(BOOST_TYPEOF_PARAM_GETTYPE(This),BOOST_PP_CAT(P,n)=(TYPEOF_GET_VALUE(BOOST_PP_CAT(d,n))));\
|
||||
typedef typename BOOST_PP_CAT(d,n)::iter BOOST_PP_CAT(iter,BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_CAST(This, n)\
|
||||
BOOST_TYPEOF_PARAM_GETTYPE(This)(BOOST_PP_CAT(P,n))
|
||||
|
||||
//
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM(r, data, n, elem)\
|
||||
BOOST_TYPEOF_VIRTUAL(DECODE, elem)(elem, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM(r, data, n, elem)\
|
||||
, BOOST_TYPEOF_VIRTUAL(ENCODE, elem)(elem, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_PAIR(r, data, n, elem)\
|
||||
BOOST_PP_COMMA_IF(n) BOOST_TYPEOF_PARAM_GETTYPE(elem) BOOST_PP_CAT(P, n)
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_CAST(r, data, n, elem)\
|
||||
BOOST_PP_COMMA_IF(n) BOOST_TYPEOF_VIRTUAL(CAST, elem)(elem, n)
|
||||
|
||||
//
|
||||
|
||||
#define BOOST_TYPEOF_ENCODE_TEMPLATE_IMPL(Name, Params, Size, ID)\
|
||||
template<>\
|
||||
struct encode_impl<ID>\
|
||||
{\
|
||||
template<typename V, BOOST_PP_ENUM_PARAMS(Size,typename P),typename Types>\
|
||||
struct encoder {\
|
||||
typedef Types BOOST_PP_CAT(types_,Size);\
|
||||
BOOST_PP_REPEAT(Size,BOOST_TYPEOF_PUSH_FRONT,Size)\
|
||||
BOOST_STATIC_CONSTANT(int,value =sizeof(BOOST_DEDUCED_TYPENAME encode_modifier<mpl::next<V>::type,BOOST_DEDUCED_TYPENAME types_0::type,types_1>::encoded_type));\
|
||||
friend sizer<ID> encode_value(const sizer<V::index>&,const sizer<V::pos>&);\
|
||||
};\
|
||||
};\
|
||||
template<\
|
||||
BOOST_PP_SEQ_FOR_EACH_I(\
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_PAIR,\
|
||||
~,\
|
||||
Params\
|
||||
),typename V,typename Types>\
|
||||
typename encode_impl<ID>::\
|
||||
encoder<\
|
||||
V\
|
||||
BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_ENCODE_PARAM,~,Params),\
|
||||
Types\
|
||||
> encode(Name<BOOST_PP_ENUM_PARAMS(Size,P)> const& (*)(V,Types));
|
||||
|
||||
#define BOOST_TYPEOF_DECODE_TEMPLATE_IMPL(Name, Params, Size, ID)\
|
||||
template<>\
|
||||
struct decode_impl<ID>\
|
||||
{\
|
||||
template<typename Iter>\
|
||||
struct decoder {\
|
||||
typedef Iter iter0;\
|
||||
BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_DECODE_PARAM,~,Params)\
|
||||
typedef Name<BOOST_PP_SEQ_FOR_EACH_I(BOOST_TYPEOF_REGISTER_TEMPLATE_PARAM_CAST,~,Params)> type;\
|
||||
typedef BOOST_PP_CAT(iter,Size) iter;\
|
||||
};\
|
||||
};
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE_IMPL(Name, Params, Size, ID)\
|
||||
namespace boost { namespace type_of{\
|
||||
BOOST_TYPEOF_ENCODE_TEMPLATE_IMPL(Name, Params, Size, ID)\
|
||||
BOOST_TYPEOF_DECODE_TEMPLATE_IMPL(Name, Params, Size, ID)\
|
||||
}}
|
||||
|
||||
|
||||
#endif //BOOST_VINTAGE_TEMPLATE_ENCODING_HPP_INCLUDED
|
@@ -1,48 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_TYPE_ENCODING_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_TYPE_ENCODING_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/config.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_ENCODE_TYPE(simple_type)\
|
||||
template<>\
|
||||
struct encode_impl<BOOST_TYPEOF_UNIQUE_ID()>\
|
||||
{\
|
||||
template<typename V,typename Types>\
|
||||
struct encoder {\
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=\
|
||||
sizeof(\
|
||||
typename encode_modifier<\
|
||||
typename mpl::next<V>::type,\
|
||||
typename Types::type,\
|
||||
typename Types::next\
|
||||
>::encoded_type\
|
||||
)\
|
||||
);\
|
||||
friend sizer<BOOST_TYPEOF_UNIQUE_ID()> encode_value(const sizer<V::index>&,const sizer<V::pos>&);\
|
||||
};\
|
||||
};\
|
||||
template<typename V,typename Types>\
|
||||
typename encode_impl<BOOST_TYPEOF_UNIQUE_ID()>::encoder<V,Types> encode(simple_type const& (*)(V,Types));
|
||||
|
||||
#define BOOST_TYPEOF_DECODE_TYPE(simple_type)\
|
||||
template<>\
|
||||
struct decode_impl<BOOST_TYPEOF_UNIQUE_ID()>\
|
||||
{\
|
||||
template<typename Iter>\
|
||||
struct decoder {\
|
||||
typedef simple_type type;\
|
||||
typedef Iter iter;\
|
||||
};\
|
||||
};\
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TYPE(simple_type)\
|
||||
namespace boost { namespace type_of{\
|
||||
BOOST_TYPEOF_ENCODE_TYPE(simple_type)\
|
||||
BOOST_TYPEOF_DECODE_TYPE(simple_type)\
|
||||
}}//namespace boost::type_of
|
||||
|
||||
#endif //BOOST_TYPEOF_VINTAGE_TYPE_ENCODING_HPP_INCLUDED
|
@@ -1,26 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_TYPE_LIST_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_TYPE_LIST_HPP_INCLUDED
|
||||
|
||||
namespace boost{ namespace type_of{
|
||||
struct empty_type_list {
|
||||
typedef empty_type_list type;
|
||||
typedef empty_type_list next;
|
||||
};
|
||||
template<typename T,typename Next=empty_type_list>
|
||||
struct type_list {
|
||||
typedef T type;
|
||||
typedef Next next;
|
||||
};
|
||||
|
||||
template<typename V,typename Types>
|
||||
int
|
||||
encode(empty_type_list const& (*)(V,Types));
|
||||
|
||||
}}//namespace boost::type_of
|
||||
|
||||
#endif //BOOST_TYPEOF_VINTAGE_TYPE_LIST_HPP_INCLUDED
|
||||
|
@@ -1,69 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_TYPE_TO_MACRO_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_TYPE_TO_MACRO_HPP_INCLUDED
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/punctuation/paren.hpp>
|
||||
#include <boost/preprocessor/seq.hpp>
|
||||
|
||||
/*
|
||||
These macros are used to dechifer template arguments into sensible macros.
|
||||
There are three predefined macro builders:
|
||||
BOOST_TYPEOF_typename - for class and typename arguments
|
||||
BOOST_TYPEOF_integral - for signed integral values, int,short,char,bool, etc.
|
||||
BOOST_TYPEOF_unsigned_integral - for unsigned integral values, unsigned, unsigned long etc.
|
||||
|
||||
All the fundamental integral types (except long long) have been pre-registered.
|
||||
In order to implement new template argument types (enums),
|
||||
you need to define a macro containing the name of the enum:
|
||||
|
||||
enum MyEnum {red=0,green=1,blue=2};
|
||||
#define BOOST_TYPEOF__MyEnum__ BOOST_TYPEOF_integral
|
||||
|
||||
//MyEnum is now treated as an integral value in template expressions.
|
||||
|
||||
template<MyEnum value>
|
||||
struct enum_class {};
|
||||
|
||||
//Is registered using
|
||||
BOOST_TYPEOF_DEFINE_TEMPLATE(enum_class,1,(MyEnum))
|
||||
*/
|
||||
|
||||
#define BOOST_TYPEOF_typename(dummy,append,arg) BOOST_PP_CAT(BOOST_TYPEOF_typename_,append)arg
|
||||
#define BOOST_TYPEOF_integral(dummy,append,arg) BOOST_PP_CAT(BOOST_TYPEOF_integral_,append)arg
|
||||
#define BOOST_TYPEOF_unsigned_integral(dummy,append,arg) BOOST_PP_CAT(BOOST_TYPEOF_unsigned_integral_,append)arg
|
||||
|
||||
#define BOOST_TYPEOF__typename__ BOOST_TYPEOF_typename BOOST_PP_LPAREN() dummy
|
||||
#define BOOST_TYPEOF__class__ BOOST_TYPEOF_typename BOOST_PP_LPAREN() dummy
|
||||
#define BOOST_TYPEOF__bool__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy
|
||||
#define BOOST_TYPEOF__char__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy
|
||||
#define BOOST_TYPEOF__short__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy
|
||||
#define BOOST_TYPEOF__int__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy
|
||||
#define BOOST_TYPEOF__long__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy
|
||||
#define BOOST_TYPEOF__unsigned__ BOOST_TYPEOF_unsigned_integral BOOST_PP_LPAREN() dummy
|
||||
#define BOOST_TYPEOF__signed__ BOOST_TYPEOF_integral BOOST_PP_LPAREN() dummy
|
||||
#define BOOST_TYPEOF__size_t__ BOOST_TYPEOF_unsigned_integral BOOST_PP_LPAREN() dummy
|
||||
#define BOOST_TYPEOF__unsigned BOOST_TYPEOF_unsigned_integral BOOST_PP_LPAREN()
|
||||
#define BOOST_TYPEOF__signed BOOST_TYPEOF_integral BOOST_PP_LPAREN()
|
||||
|
||||
|
||||
#define BOOST_TYPEOF_WRAP2(expr) expr
|
||||
#define BOOST_TYPEOF_WRAP1(expr) BOOST_TYPEOF_WRAP2 expr
|
||||
|
||||
#define BOOST_TYPEOF_ENCODE_ARGUMENT(z,n,text)\
|
||||
BOOST_TYPEOF_WRAP1((BOOST_PP_CAT(BOOST_TYPEOF__,BOOST_PP_CAT(text,__)),encode,(BOOST_PP_CAT(A,n)) BOOST_PP_RPAREN()))
|
||||
|
||||
#define BOOST_TYPEOF_ENCODE_SEQ_ELEMENT(z,n,seq)\
|
||||
BOOST_TYPEOF_ENCODE_ARGUMENT(z,n,BOOST_PP_SEQ_ELEM(n, seq))
|
||||
|
||||
#define BOOST_TYPEOF_DECODE_ARGUMENT(z,n,text)\
|
||||
BOOST_TYPEOF_WRAP1((BOOST_PP_CAT(BOOST_TYPEOF__,BOOST_PP_CAT(text,__)),decode,(n,text) BOOST_PP_RPAREN()))
|
||||
|
||||
#define BOOST_TYPEOF_DECODE_SEQ_ELEMENT(z,n,seq)\
|
||||
BOOST_TYPEOF_DECODE_ARGUMENT(z,n,BOOST_PP_SEQ_ELEM(n, seq))
|
||||
|
||||
#endif //BOOST_VINTAGE_TYPE_TO_MACRO_HPP_INCLUDED
|
||||
|
@@ -1,61 +0,0 @@
|
||||
// Copyright (C) 2004 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_VINTAGE_TYPEOF_IMPL_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_VINTAGE_TYPEOF_IMPL_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/vintage/encode_decode.hpp>
|
||||
#include <boost/typeof/vintage/sizer.hpp>
|
||||
namespace boost
|
||||
{
|
||||
namespace type_of
|
||||
{
|
||||
template<unsigned Index,unsigned Position=1>
|
||||
struct iterator {
|
||||
BOOST_STATIC_CONSTANT(unsigned,index=Index);
|
||||
BOOST_STATIC_CONSTANT(unsigned,pos=Position);
|
||||
typedef iterator<Index,pos+1> next;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct encode_type
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=BOOST_TYPEOF_INDEX(T));
|
||||
BOOST_STATIC_CONSTANT(unsigned,encode_dummy=sizeof(BOOST_DEDUCED_TYPENAME encode_modifier<iterator<value>,T,empty_type_list>::encoded_type));
|
||||
|
||||
BOOST_STATIC_CONSTANT(unsigned,next=value+1);
|
||||
friend sizer<next> encode_index(encode_counter<next>*);
|
||||
|
||||
sizer<value> resize;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
encode_type<T> encode_start(T const&);
|
||||
|
||||
template<typename Iter>
|
||||
struct decode {
|
||||
typedef typename decode_impl<Iter::value>::decoder<Iter::next>::type type;
|
||||
};
|
||||
template<>
|
||||
struct decode<int> {
|
||||
typedef int type;
|
||||
};
|
||||
template<unsigned Index,unsigned Position=1>
|
||||
struct value_iterator {
|
||||
BOOST_STATIC_CONSTANT(unsigned,pos=Position);
|
||||
BOOST_STATIC_CONSTANT(unsigned,value=BOOST_TYPEOF_VALUE(sizer<Index>,sizer<pos>));
|
||||
typedef value_iterator<Index,pos+1> next;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#define BOOST_TYPEOF(expr) \
|
||||
boost::type_of::decode<boost::type_of::value_iterator<sizeof(boost::type_of::encode_start(expr))> >::type
|
||||
|
||||
#define BOOST_TYPEOF_TPL(expr) typename BOOST_TYPEOF(expr)
|
||||
|
||||
|
||||
#endif//BOOST_TYPEOF_VINTAGE_TYPEOF_IMPL_HPP_INCLUDED
|
||||
|
||||
|
@@ -12,6 +12,55 @@ void odr_test2();
|
||||
|
||||
// trying to cause ODR violation in a class template
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
void odr_test1();
|
||||
void odr_test2();
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,==1200)
|
||||
|
||||
// trying to cause ODR violation in a class template
|
||||
|
||||
template<class T, class U>
|
||||
class sum_t
|
||||
{
|
||||
public:
|
||||
// VC7 fails using template types in typeof expression.
|
||||
typedef BOOST_TYPEOF_TPL(T() + U()) result_type;
|
||||
|
||||
sum_t(const T& t, const U& u);
|
||||
BOOST_TYPEOF_TPL(T() + U()) operator()();
|
||||
private:
|
||||
BOOST_TYPEOF_TPL(T() + U()) m_sum;
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
sum_t<T,U>::sum_t(const T& t, const U& u)
|
||||
: m_sum(t + u)
|
||||
{}
|
||||
|
||||
template<class T, class U>
|
||||
typename sum_t<T,U>::result_type sum_t<T,U>::operator()()
|
||||
{
|
||||
// BOOST_AUTO_TPL(result, m_sum);
|
||||
return m_sum;
|
||||
}
|
||||
|
||||
template<class T, class U>
|
||||
sum_t<T, U> make_sum(const T& t, const U& u)
|
||||
{
|
||||
return sum_t<T, U>(t, u);
|
||||
}
|
||||
|
||||
// trying to cause ODR violation in a function template
|
||||
|
||||
template<class T, class U>
|
||||
typename sum_t<T, U>::result_type sum(const T& t, const U& u)
|
||||
{
|
||||
BOOST_AUTO_TPL(result, t + u);
|
||||
return result;
|
||||
}
|
||||
#elif !BOOST_WORKAROUND(BOOST_MSVC,==1300)
|
||||
template<class T, class U>
|
||||
class sum_t
|
||||
{
|
||||
@@ -44,5 +93,6 @@ typename sum_t<T, U>::result_type sum(const T& t, const U& u)
|
||||
BOOST_AUTO_TPL(result, t + u);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//ODR_HPP_INCLUDED
|
||||
|
@@ -3,7 +3,6 @@
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/typeof/config.hpp>
|
||||
#if !defined(_MSC_VER) || _MSC_VER > 0x0700
|
||||
|
||||
#include <iostream>
|
||||
#include "odr.hpp"
|
||||
@@ -12,12 +11,13 @@ using namespace std;
|
||||
|
||||
void odr_test1()
|
||||
{
|
||||
#if! BOOST_WORKAROUND(BOOST_MSVC,==1300)
|
||||
char i = 5;
|
||||
double d = 3.14;
|
||||
cout << sum(d, i) << endl;
|
||||
cout << sum(i, d) << endl;
|
||||
cout << make_sum(d, i)() << endl;
|
||||
cout << make_sum(i, d)() << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif//BOOST_TYPEOF_VINTAGE
|
||||
|
@@ -2,9 +2,6 @@
|
||||
// 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>
|
||||
#if !defined(_MSC_VER) || _MSC_VER > 0x0700
|
||||
|
||||
#include <iostream>
|
||||
#include "odr.hpp"
|
||||
|
||||
@@ -12,12 +9,12 @@ using namespace std;
|
||||
|
||||
void odr_test2()
|
||||
{
|
||||
#if! BOOST_WORKAROUND(BOOST_MSVC,==1300)
|
||||
char i = 5;
|
||||
double d = 3.14;
|
||||
cout << sum(d, i) << endl;
|
||||
cout << sum(i, d) << endl;
|
||||
cout << make_sum(d, i)() << endl;
|
||||
cout << make_sum(i, d)() << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif //BOOST_TYPEOF_VINTAGE
|
||||
|
@@ -325,14 +325,10 @@ namespace test_integral
|
||||
|
||||
void odr_test()
|
||||
{
|
||||
#if !defined(_MSC_VER) || _MSC_VER > 0x0700
|
||||
|
||||
void odr_test1();
|
||||
void odr_test2();
|
||||
odr_test1();
|
||||
odr_test2();
|
||||
|
||||
#endif//BOOST_TYPEOF_VINTAGE
|
||||
}
|
||||
|
||||
#define BOOST_TYPEOF_TEXT "main()..."
|
||||
|
@@ -10,7 +10,14 @@
|
||||
void odr_test1();
|
||||
void odr_test2();
|
||||
|
||||
#if! BOOST_WORKAROUND(BOOST_MSVC,==1300)
|
||||
// trying to cause ODR violation in a class template
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
void odr_test1();
|
||||
void odr_test2();
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,==1200)
|
||||
|
||||
// trying to cause ODR violation in a class template
|
||||
|
||||
@@ -47,6 +54,39 @@ sum_t<T, U> make_sum(const T& t, const U& u)
|
||||
|
||||
// trying to cause ODR violation in a function template
|
||||
|
||||
template<class T, class U>
|
||||
typename sum_t<T, U>::result_type sum(const T& t, const U& u)
|
||||
{
|
||||
BOOST_AUTO_TPL(result, t + u);
|
||||
return result;
|
||||
}
|
||||
#elif !BOOST_WORKAROUND(BOOST_MSVC,==1300)
|
||||
template<class T, class U>
|
||||
class sum_t
|
||||
{
|
||||
public:
|
||||
typedef BOOST_TYPEOF_TPL(T() + U()) result_type;
|
||||
|
||||
sum_t(const T& t, const U& u)
|
||||
: m_sum(t + u)
|
||||
{}
|
||||
BOOST_TYPEOF_TPL(T() + U()) operator()()
|
||||
{
|
||||
BOOST_AUTO_TPL(result, m_sum);
|
||||
return result;
|
||||
}
|
||||
private:
|
||||
BOOST_TYPEOF_TPL(T() + U()) m_sum;
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
sum_t<T, U> make_sum(const T& t, const U& u)
|
||||
{
|
||||
return sum_t<T, U>(t, u);
|
||||
}
|
||||
|
||||
// trying to cause ODR violation in a function template
|
||||
|
||||
template<class T, class U>
|
||||
typename sum_t<T, U>::result_type sum(const T& t, const U& u)
|
||||
{
|
@@ -2,6 +2,8 @@
|
||||
// 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>
|
||||
|
||||
#include <iostream>
|
||||
#include "odr.hpp"
|
||||
|
||||
@@ -18,3 +20,4 @@ void odr_test1()
|
||||
cout << make_sum(i, d)() << endl;
|
||||
#endif
|
||||
}
|
||||
|
@@ -1,19 +0,0 @@
|
||||
// Copyright (C) 2004 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef MPL_REGISTER_HPP_INCLUDED
|
||||
#define MPL_REGISTER_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TYPE(boost::mpl::vector0<>);
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::vector1, 1);
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::vector2, 2);
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::vector3, 3);
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::vector4, 4);
|
||||
|
||||
#endif//MPL_REGISTER_HPP_INCLUDED
|
@@ -1,23 +0,0 @@
|
||||
// Copyright (C) 2004 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef STL_REGISTER_HPP_INCLUDED
|
||||
#define STL_REGISTER_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE_X(std::vector, (class)(class));
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(std::list, 2);
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(std::set, 3);
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(std::allocator, 1);
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(std::less, 1);
|
||||
|
||||
#endif//STL_REGISTER_HPP_INCLUDED
|
@@ -1,60 +0,0 @@
|
||||
// Copyright (C) 2004 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef TYPEID_HPP_INCLUDED
|
||||
#define TYPEID_HPP_INCLUDED
|
||||
|
||||
#include <string>
|
||||
|
||||
template<bool IsReference,bool IsConst>
|
||||
struct typeid_base {
|
||||
template<typename T>
|
||||
struct inner {
|
||||
static std::string name()
|
||||
{
|
||||
return typeid(T).name();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct typeid_base<true,false> {
|
||||
template<typename T>
|
||||
struct inner {
|
||||
static std::string name()
|
||||
{
|
||||
return std::string(typeid(T).name())+"&";
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct typeid_base<false,true> {
|
||||
template<typename T>
|
||||
struct inner {
|
||||
static std::string name()
|
||||
{
|
||||
return std::string(typeid(T).name())+" const";
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct typeid_base<true,true> {
|
||||
template<typename T>
|
||||
struct inner {
|
||||
static std::string name()
|
||||
{
|
||||
return std::string(typeid(T).name())+" const&";
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<class T> struct type_id
|
||||
: typeid_base<boost::is_reference<T>::value,boost::is_const<T>::value>::inner<T>
|
||||
{
|
||||
};
|
||||
|
||||
#endif//TYPEID_HPP_INCLUDED
|
||||
|
Reference in New Issue
Block a user