forked from boostorg/typeof
Compare commits
32 Commits
svn-branch
...
boost-1.34
Author | SHA1 | Date | |
---|---|---|---|
840c659563 | |||
f7df17a93a | |||
ed21868c25 | |||
c66289f7ac | |||
43b4d4522c | |||
8868adc891 | |||
452b493b7a | |||
eeff4e592c | |||
1b65bfc95d | |||
eda5c4afba | |||
340148f738 | |||
64ba3be86f | |||
d337b0837a | |||
dddbb00da4 | |||
935b36d8f5 | |||
5bd010787a | |||
55ac93f947 | |||
366ab1b621 | |||
aede9c2866 | |||
2b92bbcb21 | |||
dff8a5c505 | |||
a460694e5d | |||
db9203fb0e | |||
9a14e20bc5 | |||
47a4b2a2c1 | |||
337fe1fdf6 | |||
11b18afcce | |||
7cbdf2406a | |||
97b9bda347 | |||
041f9cfd24 | |||
c17f725e5f | |||
35874c8e32 |
@ -8,6 +8,7 @@
|
||||
http://www.boost.org/LICENSE_1_0.txt
|
||||
</ulink>)
|
||||
]
|
||||
[id typeof]
|
||||
[last-revision $Date$]
|
||||
]
|
||||
|
||||
@ -79,8 +80,8 @@ she would have to specify something like this:
|
||||
Not exactly elegant. To solve this problem (as well as some other problems),
|
||||
the C++ standard committee is considering
|
||||
a few additions to the standard language, such as `typeof/decltype` and `auto` (see
|
||||
[@http://www.osl.iu.edu/~jajarvi/publications/papers/decltype_n1478.pdf
|
||||
http://www.osl.iu.edu/~jajarvi/publications/papers/decltype_n1478.pdf]).
|
||||
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1607.pdf
|
||||
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1607.pdf]).
|
||||
|
||||
The `typeof` operator (or `decltype`, which is a slightly different flavor of `typeof`)
|
||||
allows one to determine the type of an expression at compile time. Using `typeof`,
|
||||
@ -100,6 +101,10 @@ and becomes widely available.
|
||||
|
||||
[section:tuto Tutorial]
|
||||
|
||||
To start using typeof include the typeof header:
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
To deduce the type of an expression at compile time
|
||||
use the `BOOST_TYPEOF` macro:
|
||||
|
||||
@ -446,12 +451,12 @@ and template template parameters:
|
||||
|
||||
* A type template parameter is described by the `(class)` or `(typename)` sequence element
|
||||
* A template parameter of a well-known integral type can be described by
|
||||
simply supplying its type, like (`unsigned int`).
|
||||
simply supplying its type, like `(unsigned int)`.
|
||||
The following well-known integral types are supported:
|
||||
* [`signed`/`unsigned`] `char`
|
||||
* [`unsigned`] `short`
|
||||
* [`unsigned`] `int`
|
||||
* [`unsigned`] `long`
|
||||
* `[signed/unsigned] char`
|
||||
* `[unsigned] short`
|
||||
* `[unsigned] int`
|
||||
* `[unsigned] long`
|
||||
* `unsigned`
|
||||
* `bool`
|
||||
* `size_t`
|
||||
@ -585,13 +590,15 @@ larger expressions.
|
||||
If you want to use `typeof_nested_typedef` in a template-context, use `BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr)`,
|
||||
which takes care of `typename` inside the `typeof` expression.
|
||||
|
||||
'typeof_nested_typedef' can not be used at function/block scope.
|
||||
|
||||
[h4 Sample Code]
|
||||
|
||||
template<typename A, typename B>
|
||||
struct result_of_conditional
|
||||
{
|
||||
BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested,true?A():B());
|
||||
typedef typename nested::type type;
|
||||
BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested,true?A():B())
|
||||
typedef typename nested::type type;
|
||||
};
|
||||
|
||||
template<typename A, typename B>
|
||||
@ -837,7 +844,7 @@ as nested classes. Instead, instantiations can be registered:
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:ackn Acknoledgements]
|
||||
[section:ackn Acknowledgements]
|
||||
|
||||
The idea of representing a type as multiple compile-time integers,
|
||||
and passing these integers across function boundaries using sizeof(),
|
||||
|
@ -1,42 +0,0 @@
|
||||
#ifndef BOOST_TYPEOF_BINDING_WORKAROUND_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_BINDING_WORKAROUND_HPP_INCLUDED
|
||||
|
||||
// workarounds related to inability to bind to const T&
|
||||
|
||||
/*
|
||||
MSVC 7.1-, from inside a template,
|
||||
can't bind a function pointer to const T&
|
||||
*/
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,==1310) && defined(BOOST_TYPEOF_EMULATION)
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
template<class V,class T>
|
||||
sizer<typename encode_type<V, T*>::type> encode(T*,
|
||||
typename enable_if<typename is_function<T>::type>::type* = 0);
|
||||
|
||||
}}
|
||||
|
||||
#elif BOOST_WORKAROUND(BOOST_MSVC,<=1310) && defined(BOOST_TYPEOF_NATIVE)
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
template<typename T>
|
||||
char (*encode_start(T*))[encode_type<T*>::value];
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
#endif//BOOST_TYPEOF_BINDING_WORKAROUND_HPP_INCLUDED
|
@ -1,6 +1,8 @@
|
||||
// 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)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// boostinspect:nounnamed
|
||||
|
||||
#ifndef BOOST_TYPEOF_ENCODE_DECODE_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_ENCODE_DECODE_HPP_INCLUDED
|
||||
@ -8,27 +10,48 @@
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mpl/next.hpp>
|
||||
|
||||
namespace boost { namespace type_of { namespace {
|
||||
#ifndef BOOST_TYPEOF_SUPPRESS_UNNAMED_NAMESPACE
|
||||
|
||||
template<class V, class Type_Not_Registered_With_Typeof_System>
|
||||
struct encode_type_impl;
|
||||
|
||||
template<class T, class Iter>
|
||||
struct decode_type_impl
|
||||
{
|
||||
typedef int type; // MSVC ETI workaround
|
||||
};
|
||||
# define BOOST_TYPEOF_BEGIN_ENCODE_NS namespace { namespace boost_typeof {
|
||||
# define BOOST_TYPEOF_END_ENCODE_NS }}
|
||||
# define BOOST_TYPEOF_ENCODE_NS_QUALIFIER boost_typeof
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_TYPEOF_BEGIN_ENCODE_NS namespace boost { namespace type_of {
|
||||
# define BOOST_TYPEOF_END_ENCODE_NS }}
|
||||
# define BOOST_TYPEOF_ENCODE_NS_QUALIFIER boost::type_of
|
||||
|
||||
# define BOOST_TYPEOF_TEXT "unnamed namespace is off"
|
||||
# include <boost/typeof/message.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
BOOST_TYPEOF_BEGIN_ENCODE_NS
|
||||
|
||||
template<class V, class Type_Not_Registered_With_Typeof_System>
|
||||
struct encode_type_impl;
|
||||
|
||||
template<class T, class Iter>
|
||||
struct decode_type_impl
|
||||
{
|
||||
typedef int type; // MSVC ETI workaround
|
||||
};
|
||||
|
||||
BOOST_TYPEOF_END_ENCODE_NS
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
template<class V, class T>
|
||||
struct encode_type : encode_type_impl<V, T>
|
||||
struct encode_type : BOOST_TYPEOF_ENCODE_NS_QUALIFIER::encode_type_impl<V, T>
|
||||
{};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type : decode_type_impl<
|
||||
struct decode_type : BOOST_TYPEOF_ENCODE_NS_QUALIFIER::decode_type_impl<
|
||||
typename Iter::type,
|
||||
typename Iter::next
|
||||
>
|
||||
{};
|
||||
}}}
|
||||
}}
|
||||
|
||||
#endif//BOOST_TYPEOF_ENCODE_DECODE_HPP_INCLUDED
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Copyright (C) 2005 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
@ -11,7 +11,7 @@
|
||||
// Assumes iter0 contains initial iterator
|
||||
|
||||
#define BOOST_TYPEOF_DECODE_PARAM(z, n, text) \
|
||||
typedef decode_type<iter##n> decode##n; \
|
||||
typedef boost::type_of::decode_type<iter##n> decode##n; \
|
||||
typedef typename decode##n::type p##n; \
|
||||
typedef typename decode##n::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n));
|
||||
|
||||
@ -21,14 +21,14 @@
|
||||
// The P0, P1, ... PN are encoded and added to V
|
||||
|
||||
#define BOOST_TYPEOF_ENCODE_PARAMS_BEGIN(z, n, text)\
|
||||
typename encode_type<
|
||||
typename boost::type_of::encode_type<
|
||||
|
||||
#define BOOST_TYPEOF_ENCODE_PARAMS_END(z, n, text)\
|
||||
, BOOST_PP_CAT(P, n)>::type
|
||||
|
||||
#define BOOST_TYPEOF_ENCODE_PARAMS(n, ID) \
|
||||
BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_BEGIN, ~) \
|
||||
typename push_back<V, mpl::size_t<ID> >::type \
|
||||
typename boost::type_of::push_back<V, boost::mpl::size_t<ID> >::type \
|
||||
BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_END, ~)
|
||||
|
||||
#endif//BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
|
@ -68,9 +68,12 @@ namespace boost { namespace type_of {
|
||||
{};
|
||||
|
||||
template<class V, class T, T n>
|
||||
struct encode_integral : encode_size_t< V, (typename get_unsigned<T>::type)n >
|
||||
struct encode_integral : encode_size_t< V, (typename get_unsigned<T>::type)n,(((typename get_unsigned<T>::type)n)>=0x3fffffff) >
|
||||
{};
|
||||
|
||||
template<class V, bool b>
|
||||
struct encode_integral<V, bool, b> : encode_size_t< V, b?1:0, false>
|
||||
{};
|
||||
///////////////////////////
|
||||
|
||||
template<std::size_t n, class Iter, bool overflow>
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Copyright (C) 2005 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_INTEGRAL_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_INTEGRAL_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
@ -55,14 +55,14 @@
|
||||
// INTEGRAL_PARAM "virtual functions" implementation
|
||||
|
||||
#define BOOST_TYPEOF_INTEGRAL_PARAM_ENCODE(This, n)\
|
||||
typedef typename encode_integral<\
|
||||
typedef typename boost::type_of::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);\
|
||||
typedef boost::type_of::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));
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// 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)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_MODIFIERS_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_MODIFIERS_HPP_INCLUDED
|
||||
@ -16,16 +16,16 @@
|
||||
template<class V, class T> struct encode_type_impl<V, Fun(T)>\
|
||||
{\
|
||||
typedef\
|
||||
typename encode_type<\
|
||||
typename push_back<\
|
||||
typename boost::type_of::encode_type<\
|
||||
typename boost::type_of::push_back<\
|
||||
V\
|
||||
, mpl::size_t<ID> >::type\
|
||||
, boost::mpl::size_t<ID> >::type\
|
||||
, T>::type\
|
||||
type;\
|
||||
};\
|
||||
template<class Iter> struct decode_type_impl<mpl::size_t<ID>, Iter>\
|
||||
template<class Iter> struct decode_type_impl<boost::mpl::size_t<ID>, Iter>\
|
||||
{\
|
||||
typedef decode_type<Iter> d1;\
|
||||
typedef boost::type_of::decode_type<Iter> d1;\
|
||||
typedef Fun(typename d1::type) type;\
|
||||
typedef typename d1::iter iter;\
|
||||
}
|
||||
@ -36,15 +36,15 @@
|
||||
#define BOOST_TYPEOF_pointer_fun(T) T*
|
||||
#define BOOST_TYPEOF_reference_fun(T) T&
|
||||
|
||||
namespace boost { namespace type_of { namespace {
|
||||
BOOST_TYPEOF_BEGIN_ENCODE_NS
|
||||
|
||||
BOOST_TYPEOF_modifier_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_TYPEOF_const_fun);
|
||||
BOOST_TYPEOF_modifier_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_TYPEOF_volatile_fun);
|
||||
BOOST_TYPEOF_modifier_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_TYPEOF_volatile_const_fun);
|
||||
BOOST_TYPEOF_modifier_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_TYPEOF_pointer_fun);
|
||||
BOOST_TYPEOF_modifier_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_TYPEOF_reference_fun);
|
||||
BOOST_TYPEOF_modifier_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_TYPEOF_const_fun);
|
||||
BOOST_TYPEOF_modifier_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_TYPEOF_volatile_fun);
|
||||
BOOST_TYPEOF_modifier_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_TYPEOF_volatile_const_fun);
|
||||
BOOST_TYPEOF_modifier_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_TYPEOF_pointer_fun);
|
||||
BOOST_TYPEOF_modifier_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_TYPEOF_reference_fun);
|
||||
|
||||
}}}
|
||||
BOOST_TYPEOF_END_ENCODE_NS
|
||||
|
||||
#undef BOOST_TYPEOF_modifier_support
|
||||
#undef BOOST_TYPEOF_const_fun
|
||||
@ -60,32 +60,32 @@ namespace boost { namespace type_of { namespace {
|
||||
struct encode_type_impl<V, Qualifier() T[N]>\
|
||||
{\
|
||||
typedef\
|
||||
typename encode_type<\
|
||||
typename push_back<\
|
||||
typename push_back<\
|
||||
typename boost::type_of::encode_type<\
|
||||
typename boost::type_of::push_back<\
|
||||
typename boost::type_of::push_back<\
|
||||
V\
|
||||
, mpl::size_t<ID> >::type\
|
||||
, mpl::size_t<N> >::type\
|
||||
, boost::mpl::size_t<ID> >::type\
|
||||
, boost::mpl::size_t<N> >::type\
|
||||
, T>::type\
|
||||
type;\
|
||||
};\
|
||||
template<class Iter>\
|
||||
struct decode_type_impl<mpl::size_t<ID>, Iter>\
|
||||
struct decode_type_impl<boost::mpl::size_t<ID>, Iter>\
|
||||
{\
|
||||
enum{n = Iter::type::value};\
|
||||
typedef decode_type<typename Iter::next> d;\
|
||||
typedef boost::type_of::decode_type<typename Iter::next> d;\
|
||||
typedef typename d::type Qualifier() type[n];\
|
||||
typedef typename d::iter iter;\
|
||||
}
|
||||
|
||||
namespace boost { namespace type_of { namespace {
|
||||
BOOST_TYPEOF_BEGIN_ENCODE_NS
|
||||
|
||||
BOOST_TYPEOF_array_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_PP_EMPTY);
|
||||
BOOST_TYPEOF_array_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_PP_IDENTITY(const));
|
||||
BOOST_TYPEOF_array_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_PP_IDENTITY(volatile));
|
||||
BOOST_TYPEOF_array_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_PP_IDENTITY(volatile const));
|
||||
BOOST_TYPEOF_array_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_PP_EMPTY);
|
||||
BOOST_TYPEOF_array_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_PP_IDENTITY(const));
|
||||
BOOST_TYPEOF_array_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_PP_IDENTITY(volatile));
|
||||
BOOST_TYPEOF_array_support(BOOST_TYPEOF_UNIQUE_ID(), BOOST_PP_IDENTITY(volatile const));
|
||||
|
||||
}}}
|
||||
BOOST_TYPEOF_END_ENCODE_NS
|
||||
|
||||
#undef BOOST_TYPEOF_array_support
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
# include <boost/mpl/int.hpp>
|
||||
# include <boost/type_traits/is_function.hpp>
|
||||
# include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -145,8 +147,28 @@ namespace boost
|
||||
BOOST_TYPEOF_NEXT_INDEX(next);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct sizer
|
||||
{
|
||||
typedef char(*type)[encode_type<T>::value];
|
||||
};
|
||||
|
||||
# ifdef BOOST_NO_SFINAE
|
||||
|
||||
template<typename T>
|
||||
char (*encode_start(T const&))[encode_type<T>::value];
|
||||
typename sizer<T>::type encode_start(T const&);
|
||||
|
||||
# else
|
||||
|
||||
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&);
|
||||
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
|
60
include/boost/typeof/native.hpp
Executable file
60
include/boost/typeof/native.hpp
Executable file
@ -0,0 +1,60 @@
|
||||
// Copyright (C) 2006 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_NATIVE_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_NATIVE_HPP_INCLUDED
|
||||
|
||||
#ifndef MSVC_TYPEOF_HACK
|
||||
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
template<class T>
|
||||
T& ensure_obj(const T&);
|
||||
|
||||
}}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
# ifdef BOOST_NO_SFINAE
|
||||
template<class T>
|
||||
T& ensure_obj(const T&);
|
||||
# else
|
||||
template<typename T>
|
||||
typename enable_if<is_function<T>, T&>::type
|
||||
ensure_obj(T&);
|
||||
|
||||
template<typename T>
|
||||
typename disable_if<is_function<T>, T&>::type
|
||||
ensure_obj(const T&);
|
||||
# endif
|
||||
}}
|
||||
|
||||
#endif//BOOST_NO_SFINAE
|
||||
|
||||
#define BOOST_TYPEOF(expr) BOOST_TYPEOF_KEYWORD(boost::type_of::ensure_obj(expr))
|
||||
#define BOOST_TYPEOF_TPL BOOST_TYPEOF
|
||||
|
||||
#define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
|
||||
struct name {\
|
||||
typedef BOOST_TYPEOF_TPL(expr) type;\
|
||||
};
|
||||
|
||||
#define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
|
||||
struct name {\
|
||||
typedef BOOST_TYPEOF(expr) type;\
|
||||
};
|
||||
|
||||
#endif//MSVC_TYPEOF_HACK
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TYPE(x)
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)
|
||||
|
||||
#endif//BOOST_TYPEOF_NATIVE_HPP_INCLUDED
|
||||
|
@ -10,35 +10,30 @@
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
namespace boost
|
||||
BOOST_TYPEOF_BEGIN_ENCODE_NS
|
||||
|
||||
enum {PTR_DATA_MEM_ID = BOOST_TYPEOF_UNIQUE_ID()};
|
||||
|
||||
template<class V, class P0, class P1>
|
||||
struct encode_type_impl<V, P0 P1::*>
|
||||
{
|
||||
namespace type_of
|
||||
{
|
||||
namespace
|
||||
{
|
||||
enum {PTR_DATA_MEM_ID = BOOST_TYPEOF_UNIQUE_ID()};
|
||||
typedef BOOST_TYPEOF_ENCODE_PARAMS(2, PTR_DATA_MEM_ID) type;
|
||||
};
|
||||
|
||||
template<class V, class P0, class P1>
|
||||
struct encode_type_impl<V, P0 P1::*>
|
||||
{
|
||||
typedef BOOST_TYPEOF_ENCODE_PARAMS(2, PTR_DATA_MEM_ID) type;
|
||||
};
|
||||
template<class Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<PTR_DATA_MEM_ID>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(2)
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<mpl::size_t<PTR_DATA_MEM_ID>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(2)
|
||||
template<class T> struct workaround{
|
||||
typedef p0 T::* type;
|
||||
};
|
||||
|
||||
template<class T> struct workaround{
|
||||
typedef p0 T::* type;
|
||||
};
|
||||
typedef typename workaround<p1>::type type;
|
||||
typedef iter2 iter;
|
||||
};
|
||||
|
||||
typedef typename workaround<p1>::type type;
|
||||
typedef iter2 iter;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
BOOST_TYPEOF_END_ENCODE_NS
|
||||
|
||||
#endif//BOOST_TYPEOF_POINTERS_DATA_MEMBERS_HPP_INCLUDED
|
||||
|
@ -32,11 +32,12 @@ enum
|
||||
VOLATILE_CONST_MEM_FUN_ID = FUN_ID + 6 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY)
|
||||
};
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
BOOST_TYPEOF_BEGIN_ENCODE_NS
|
||||
|
||||
# define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPEOF_LIMIT_FUNCTION_ARITY)
|
||||
# define BOOST_PP_FILENAME_1 <boost/typeof/register_functions_iterate.hpp>
|
||||
# include BOOST_PP_ITERATE()
|
||||
}}
|
||||
# define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPEOF_LIMIT_FUNCTION_ARITY)
|
||||
# define BOOST_PP_FILENAME_1 <boost/typeof/register_functions_iterate.hpp>
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
BOOST_TYPEOF_END_ENCODE_NS
|
||||
|
||||
#endif//BOOST_TYPEOF_REGISTER_FUNCTIONS_HPP_INCLUDED
|
||||
|
@ -1,30 +1,28 @@
|
||||
// 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)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/typeof/encode_decode_params.hpp>
|
||||
|
||||
#define n BOOST_PP_ITERATION()
|
||||
|
||||
namespace
|
||||
// function pointers
|
||||
|
||||
template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
|
||||
struct encode_type_impl<V, R(*)(BOOST_PP_ENUM_PARAMS(n, P))>
|
||||
{
|
||||
// function pointers
|
||||
typedef R BOOST_PP_CAT(P, n);
|
||||
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_PTR_ID + n) type;
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<mpl::size_t<FUN_PTR_ID + n>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
|
||||
typedef BOOST_PP_CAT(p, n)(*type)(BOOST_PP_ENUM_PARAMS(n, p));
|
||||
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
|
||||
};
|
||||
template<class Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
|
||||
typedef BOOST_PP_CAT(p, n)(*type)(BOOST_PP_ENUM_PARAMS(n, p));
|
||||
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
|
||||
};
|
||||
|
||||
#ifndef BOOST_TYPEOF_NO_FUNCTION_TYPES
|
||||
|
||||
@ -38,7 +36,7 @@ namespace
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<mpl::size_t<FUN_REF_ID + n>, Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<FUN_REF_ID + n>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
|
||||
@ -56,7 +54,7 @@ namespace
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<mpl::size_t<FUN_ID + n>, Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<FUN_ID + n>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
|
||||
@ -66,23 +64,22 @@ namespace
|
||||
|
||||
#endif//BOOST_TYPEOF_NO_FUNCTION_TYPES
|
||||
|
||||
// member functions
|
||||
// member functions
|
||||
|
||||
#define BOOST_TYPEOF_qualifier
|
||||
#define BOOST_TYPEOF_id MEM_FUN_ID
|
||||
#include <boost/typeof/register_mem_functions.hpp>
|
||||
#define BOOST_TYPEOF_qualifier
|
||||
#define BOOST_TYPEOF_id MEM_FUN_ID
|
||||
#include <boost/typeof/register_mem_functions.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_qualifier const
|
||||
#define BOOST_TYPEOF_id CONST_MEM_FUN_ID
|
||||
#include <boost/typeof/register_mem_functions.hpp>
|
||||
#define BOOST_TYPEOF_qualifier const
|
||||
#define BOOST_TYPEOF_id CONST_MEM_FUN_ID
|
||||
#include <boost/typeof/register_mem_functions.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_qualifier volatile
|
||||
#define BOOST_TYPEOF_id VOLATILE_MEM_FUN_ID
|
||||
#include <boost/typeof/register_mem_functions.hpp>
|
||||
#define BOOST_TYPEOF_qualifier volatile
|
||||
#define BOOST_TYPEOF_id VOLATILE_MEM_FUN_ID
|
||||
#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/register_mem_functions.hpp>
|
||||
}
|
||||
#define BOOST_TYPEOF_qualifier volatile const
|
||||
#define BOOST_TYPEOF_id VOLATILE_CONST_MEM_FUN_ID
|
||||
#include <boost/typeof/register_mem_functions.hpp>
|
||||
|
||||
#undef n
|
||||
|
@ -15,7 +15,7 @@ struct encode_type_impl<V, R(T::*)(BOOST_PP_ENUM_PARAMS(n, P)) BOOST_TYPEOF_qual
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<mpl::size_t<BOOST_TYPEOF_id + n>, Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<BOOST_TYPEOF_id + n>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_ADD(n, 2))
|
||||
|
@ -1,7 +1,7 @@
|
||||
// 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)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_TEMPLATE_ENCODING_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TEMPLATE_ENCODING_HPP_INCLUDED
|
||||
@ -128,14 +128,14 @@
|
||||
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_BEGIN_ENCODE_NS\
|
||||
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 push_back<V, boost::mpl::size_t<ID> >::type V0;\
|
||||
typedef typename boost::type_of::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;\
|
||||
};\
|
||||
@ -147,6 +147,6 @@
|
||||
BOOST_TYPEOF_TYPEDEF_DECODED_TYPE(Name, Params)\
|
||||
typedef BOOST_PP_CAT(iter, Size) iter;\
|
||||
};\
|
||||
}}}
|
||||
BOOST_TYPEOF_END_ENCODE_NS
|
||||
|
||||
#endif//BOOST_TYPEOF_TEMPLATE_ENCODING_HPP_INCLUDED
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (C) 2005 Peder Holt
|
||||
// Copyright (C) 2005 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
@ -23,12 +23,12 @@
|
||||
|
||||
//Encode / decode this
|
||||
#define BOOST_TYPEOF_TEMPLATE_PARAM_ENCODE(This, n)\
|
||||
typedef typename encode_template<BOOST_PP_CAT(V, n),\
|
||||
typedef typename boost::type_of::encode_template<BOOST_PP_CAT(V, n),\
|
||||
BOOST_PP_CAT(P, n)<BOOST_TYPEOF_SEQ_ENUM(BOOST_TYPEOF_MAKE_OBJS(BOOST_TYPEOF_TEMPLATE_PARAM_GETPARAMS(This)),BOOST_TYPEOF_PLACEHOLDER) >\
|
||||
>::type BOOST_PP_CAT(V, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_TEMPLATE_PARAM_DECODE(This, n)\
|
||||
typedef decode_template< BOOST_PP_CAT(iter, n) > BOOST_PP_CAT(d, n);\
|
||||
typedef boost::type_of::decode_template< 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));
|
||||
|
||||
@ -51,22 +51,22 @@
|
||||
////////////////////////////
|
||||
// move to encode_decode?
|
||||
|
||||
BOOST_TYPEOF_BEGIN_ENCODE_NS
|
||||
|
||||
template<class V, class Type_Not_Registered_With_Typeof_System> struct encode_template_impl;
|
||||
template<class T, class Iter> struct decode_template_impl;
|
||||
|
||||
BOOST_TYPEOF_END_ENCODE_NS
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
namespace
|
||||
{
|
||||
template<class V, class Type_Not_Registered_With_Typeof_System> struct encode_template_impl;
|
||||
template<class T, class Iter> struct decode_template_impl;
|
||||
}
|
||||
|
||||
template<class V, class T> struct encode_template
|
||||
: encode_template_impl<V, T>
|
||||
: BOOST_TYPEOF_ENCODE_NS_QUALIFIER::encode_template_impl<V, T>
|
||||
{};
|
||||
|
||||
template<class Iter> struct decode_template
|
||||
: decode_template_impl<typename Iter::type, typename Iter::next>
|
||||
: BOOST_TYPEOF_ENCODE_NS_QUALIFIER::decode_template_impl<typename Iter::type, typename Iter::next>
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
////////////////////////////
|
||||
@ -81,10 +81,10 @@ namespace boost { namespace type_of {
|
||||
BOOST_PP_ENUM_PARAMS(\
|
||||
BOOST_PP_SEQ_SIZE(Params),\
|
||||
P)> >\
|
||||
: push_back<V, mpl::size_t<ID> >\
|
||||
: boost::type_of::push_back<V, boost::mpl::size_t<ID> >\
|
||||
{\
|
||||
};\
|
||||
template<class Iter> struct decode_template_impl<mpl::size_t<ID>, Iter>\
|
||||
template<class Iter> struct decode_template_impl<boost::mpl::size_t<ID>, Iter>\
|
||||
{\
|
||||
BOOST_PP_REPEAT(BOOST_PP_SEQ_SIZE(Params),BOOST_TYPEOF_TYPEDEF_INT_PN,_)\
|
||||
typedef Name<BOOST_TYPEOF_SEQ_ENUM(Params,BOOST_TYPEOF_PLACEHOLDER) > type;\
|
||||
|
@ -1,6 +1,6 @@
|
||||
// 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)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED
|
||||
@ -8,18 +8,18 @@
|
||||
#define BOOST_TYPEOF_REGISTER_TYPE_IMPL(T, Id) \
|
||||
\
|
||||
template<class V> struct encode_type_impl<V, T > \
|
||||
: push_back<V, mpl::size_t<Id> > \
|
||||
: boost::type_of::push_back<V, boost::mpl::size_t<Id> > \
|
||||
{}; \
|
||||
template<class Iter> struct decode_type_impl<mpl::size_t<Id>, Iter> \
|
||||
template<class Iter> struct decode_type_impl<boost::mpl::size_t<Id>, Iter> \
|
||||
{ \
|
||||
typedef T type; \
|
||||
typedef Iter iter; \
|
||||
};
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TYPE_EXPLICIT_ID(Type, Id) \
|
||||
namespace boost { namespace type_of { namespace { \
|
||||
BOOST_TYPEOF_REGISTER_TYPE_IMPL(Type, Id) \
|
||||
}}}
|
||||
BOOST_TYPEOF_BEGIN_ENCODE_NS \
|
||||
BOOST_TYPEOF_REGISTER_TYPE_IMPL(Type, Id) \
|
||||
BOOST_TYPEOF_END_ENCODE_NS
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TYPE(Type) \
|
||||
BOOST_TYPEOF_REGISTER_TYPE_EXPLICIT_ID(Type, BOOST_TYPEOF_UNIQUE_ID())
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Copyright (C) 2005 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_TYPE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TYPE_TEMPLATE_PARAM_HPP_INCLUDED
|
||||
@ -19,13 +19,13 @@
|
||||
// TYPE_PARAM "virtual functions" implementation
|
||||
|
||||
#define BOOST_TYPEOF_TYPE_PARAM_ENCODE(This, n)\
|
||||
typedef typename encode_type<\
|
||||
typedef typename boost::type_of::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 boost::type_of::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));
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// 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)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
|
||||
@ -122,10 +122,11 @@
|
||||
BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__
|
||||
|
||||
#define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
|
||||
<boost/typeof/increment_registration_group.hpp>
|
||||
<boost/typeof/incr_registration_group.hpp>
|
||||
|
||||
#ifdef BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_TEXT "using typeof emulation"
|
||||
# include <boost/typeof/message.hpp>
|
||||
# include <boost/typeof/typeof_impl.hpp>
|
||||
# include <boost/typeof/type_encoding.hpp>
|
||||
# include <boost/typeof/template_encoding.hpp>
|
||||
@ -136,32 +137,12 @@
|
||||
|
||||
#elif defined(BOOST_TYPEOF_NATIVE)
|
||||
# define BOOST_TYPEOF_TEXT "using native typeof"
|
||||
# ifndef MSVC_TYPEOF_HACK
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
template<class T> T& ensure_obj(const T&);
|
||||
}}
|
||||
|
||||
# define BOOST_TYPEOF(expr) BOOST_TYPEOF_KEYWORD(boost::type_of::ensure_obj(expr))
|
||||
# define BOOST_TYPEOF_TPL BOOST_TYPEOF
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
|
||||
struct name {\
|
||||
typedef BOOST_TYPEOF_TPL(expr) type;\
|
||||
};
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
|
||||
struct name {\
|
||||
typedef BOOST_TYPEOF(expr) type;\
|
||||
};
|
||||
# endif
|
||||
# define BOOST_TYPEOF_REGISTER_TYPE(x)
|
||||
# define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)
|
||||
# include <boost/typeof/message.hpp>
|
||||
# include <boost/typeof/native.hpp>
|
||||
#else
|
||||
# error typeof configuration error
|
||||
#endif
|
||||
|
||||
#include <boost/typeof/message.hpp>
|
||||
#include <boost/typeof/binding_workaround.hpp>
|
||||
|
||||
// auto
|
||||
#define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr
|
||||
#define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (C) 2004, 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)
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_TYPEOF_IMPL_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TYPEOF_IMPL_HPP_INCLUDED
|
||||
@ -10,6 +10,8 @@
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/typeof/encode_decode.hpp>
|
||||
#include <boost/typeof/vector.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
#define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::type_of::vector, n)
|
||||
|
||||
@ -26,13 +28,28 @@ namespace boost { namespace type_of {
|
||||
|
||||
BOOST_PP_REPEAT(BOOST_TYPEOF_LIMIT_SIZE, BOOST_TYPEOF_sizer_item, ~)
|
||||
};
|
||||
|
||||
template<class V,class T>
|
||||
sizer<typename encode_type<V, T>::type> encode(const T&);
|
||||
}}
|
||||
|
||||
#undef BOOST_TYPEOF_sizer_item
|
||||
|
||||
//
|
||||
namespace boost { namespace type_of {
|
||||
# ifdef BOOST_NO_SFINAE
|
||||
template<class V, class T>
|
||||
sizer<typename encode_type<V, T>::type> encode(const T&);
|
||||
# else
|
||||
template<class V, class T>
|
||||
typename enable_if<
|
||||
typename is_function<T>::type,
|
||||
sizer<typename encode_type<V, T>::type> >::type encode(T&);
|
||||
|
||||
template<class V, class T>
|
||||
typename disable_if<
|
||||
typename is_function<T>::type,
|
||||
sizer<typename encode_type<V, T>::type> >::type encode(const T&);
|
||||
# endif
|
||||
}}
|
||||
//
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
template<class V>
|
||||
@ -77,6 +94,18 @@ namespace boost { namespace type_of {
|
||||
BOOST_STATIC_CONSTANT(int,BOOST_PP_CAT(value,n) = sizeof(boost::type_of::encode<_typeof_start_vector>(expr).item ## n));\
|
||||
typedef boost::mpl::size_t<BOOST_PP_CAT(value,n)> BOOST_PP_CAT(item,n);
|
||||
|
||||
#ifdef __DMC__
|
||||
#define BOOST_TYPEOF_NESTED_TYPEITEM_2(z,n,expr)\
|
||||
typedef typename _typeof_encode_fraction<iteration>::BOOST_PP_CAT(item,n) BOOST_PP_CAT(item,n);
|
||||
|
||||
#define BOOST_TYPEOF_FRACTIONTYPE()\
|
||||
BOOST_PP_REPEAT(BOOST_TYPEOF_LIMIT_SIZE,BOOST_TYPEOF_NESTED_TYPEITEM_2,_)\
|
||||
typedef _typeof_fraction_iter<Pos> fraction_type;
|
||||
#else
|
||||
#define BOOST_TYPEOF_FRACTIONTYPE()\
|
||||
typedef _typeof_encode_fraction<iteration> fraction_type;
|
||||
#endif
|
||||
|
||||
#define BOOST_TYPEOF_NESTED_TYPEDEF_IMPL(expr) \
|
||||
template<int _Typeof_Iteration>\
|
||||
struct _typeof_encode_fraction {\
|
||||
@ -89,10 +118,24 @@ namespace boost { namespace type_of {
|
||||
BOOST_STATIC_CONSTANT(int,pos=(Pos::value));\
|
||||
BOOST_STATIC_CONSTANT(int,iteration=(pos/BOOST_TYPEOF_LIMIT_SIZE));\
|
||||
BOOST_STATIC_CONSTANT(int,where=pos%BOOST_TYPEOF_LIMIT_SIZE);\
|
||||
typedef typename boost::type_of::v_iter<_typeof_encode_fraction<iteration>,boost::mpl::int_<where> >::type type;\
|
||||
BOOST_TYPEOF_FRACTIONTYPE();\
|
||||
typedef typename boost::type_of::v_iter<fraction_type,boost::mpl::int_<where> >::type type;\
|
||||
typedef _typeof_fraction_iter<typename Pos::next> next;\
|
||||
};
|
||||
|
||||
#ifdef __MWERKS__
|
||||
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
|
||||
template<typename T>\
|
||||
struct BOOST_PP_CAT(_typeof_template_,name) {\
|
||||
BOOST_TYPEOF_NESTED_TYPEDEF_IMPL(expr)\
|
||||
typedef typename boost::type_of::decode_type<_typeof_fraction_iter<boost::mpl::size_t<0> > >::type type;\
|
||||
};\
|
||||
typedef BOOST_PP_CAT(_typeof_template_,name)<int> name;
|
||||
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) BOOST_TYPEOF_NESTED_TYPEDEF(name,expr);
|
||||
|
||||
#else
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
|
||||
struct name {\
|
||||
BOOST_TYPEOF_NESTED_TYPEDEF_IMPL(expr)\
|
||||
@ -104,5 +147,6 @@ namespace boost { namespace type_of {
|
||||
BOOST_TYPEOF_NESTED_TYPEDEF_IMPL(expr)\
|
||||
typedef boost::type_of::decode_type<_typeof_fraction_iter<boost::mpl::size_t<0> > >::type type;\
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif//BOOST_TYPEOF_COMPLIANT_TYPEOF_IMPL_HPP_INCLUDED
|
||||
|
@ -1,3 +1,9 @@
|
||||
<!--
|
||||
Copyright (C) 2006 Arkadiy Vertleyb
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL=../../doc/html/typeof.html">
|
||||
|
79
test/Jamfile
79
test/Jamfile
@ -1,79 +0,0 @@
|
||||
# Boost Typeof Library test Jamfile
|
||||
|
||||
subproject libs/typeof/test ;
|
||||
|
||||
# bring in rules for testing
|
||||
import testing ;
|
||||
|
||||
local rule special-requirements ( toolset variant : properties * )
|
||||
{
|
||||
# Tru64/CXX6.5 hangs on most tests, so just turn it off completely.
|
||||
|
||||
if $(UNIX) && $(OS) = OSF
|
||||
{
|
||||
switch $(toolset)
|
||||
{
|
||||
case tru64cxx65* : properties =
|
||||
[ replace-properties $(properties) : <build>no ] ;
|
||||
}
|
||||
}
|
||||
|
||||
return $(properties) ;
|
||||
}
|
||||
|
||||
test-suite "typeof"
|
||||
:
|
||||
[ compile type.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : type_native ]
|
||||
[ compile type.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : type_emulation ]
|
||||
|
||||
[ compile template_type.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : template_type_native ]
|
||||
[ compile template_type.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : template_type_emulation ]
|
||||
|
||||
[ compile template_int.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : template_int_native ]
|
||||
[ compile template_int.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : template_int_emulation ]
|
||||
|
||||
[ compile template_tpl.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : template_tpl_native ]
|
||||
[ compile template_tpl.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : template_tpl_emulation ]
|
||||
|
||||
[ compile template_enum.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : template_enum_native ]
|
||||
[ compile template_enum.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : template_enum_emulation ]
|
||||
|
||||
[ compile template_dependent.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : template_dependent_native ]
|
||||
[ compile template_dependent.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : template_dependent_emulation ]
|
||||
|
||||
[ compile template_multiword.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : template_multiword_native ]
|
||||
[ compile template_multiword.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : template_multiword_emulation ]
|
||||
|
||||
[ compile modifiers.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : modifiers_native ]
|
||||
[ compile modifiers.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : modifiers_emulation ]
|
||||
|
||||
[ compile function.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : function_native ]
|
||||
[ compile function.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : function_emulation ]
|
||||
|
||||
[ compile function_ptr.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : function_ptr_native ]
|
||||
[ compile function_ptr.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : function_ptr_emulation ]
|
||||
|
||||
[ compile function_ref.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : function_ref_native ]
|
||||
[ compile function_ref.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : function_ref_emulation ]
|
||||
|
||||
[ compile member_function.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : member_function_native ]
|
||||
[ compile member_function.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : member_function_emulation ]
|
||||
|
||||
[ compile data_member.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : data_member_native ]
|
||||
[ compile data_member.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : data_member_emulation ]
|
||||
|
||||
[ compile noncopyable.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : noncopyable_native ]
|
||||
[ compile noncopyable.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : noncopyable_emulation ]
|
||||
|
||||
[ compile std.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : std_native ]
|
||||
[ compile std.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : std_emulation ]
|
||||
|
||||
[ run odr1.cpp odr2.cpp : : : <define>BOOST_TYPEOF_NATIVE special-requirements : odr_native ]
|
||||
[ run odr1.cpp odr2.cpp : : : <define>BOOST_TYPEOF_COMPLIANT special-requirements : odr_emulation ]
|
||||
|
||||
[ compile function_ptr_from_tpl.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : function_ptr_from_tpl_native ]
|
||||
[ compile function_ptr_from_tpl.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : function_ptr_from_tpl_emulation ]
|
||||
|
||||
[ compile nested_typedef.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : nested_typedef_native ]
|
||||
[ compile nested_typedef.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : nested_typedef_emulation ]
|
||||
;
|
@ -1,3 +1,8 @@
|
||||
# Copyright (C) 2006 Vladimir Prus
|
||||
# Copyright (C) 2006 Arkadiy Vertleyb
|
||||
# Use, modification and distribution is subject to the Boost Software
|
||||
# License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# Boost Typeof Library test Jamfile
|
||||
|
||||
import set ;
|
||||
@ -24,7 +29,7 @@ rule typeof-test ( source )
|
||||
{
|
||||
return [ compile $(source) : <define>BOOST_TYPEOF_NATIVE :
|
||||
$(source:B)_native ]
|
||||
[ compile $(source) : <define>BOOST_TYPEOF_COMPLIANT :
|
||||
[ compile $(source) : <define>BOOST_TYPEOF_EMULATION :
|
||||
$(source:B)_emulation ]
|
||||
;
|
||||
}
|
||||
@ -32,14 +37,17 @@ rule typeof-test ( source )
|
||||
rule all-tests ( )
|
||||
{
|
||||
local all ;
|
||||
for local t in [ set.difference [ glob *.cpp ] : odr1.cpp odr2.cpp ]
|
||||
# for local t in [ set.difference [ glob *.cpp ] : odr1.cpp odr2.cpp ]
|
||||
for local t in [ set.difference [ glob *.cpp ] : [ glob odr*.cpp ] ]
|
||||
{
|
||||
all += [ typeof-test $(t) ] ;
|
||||
}
|
||||
all += [ run odr1.cpp odr2.cpp : : : <define>BOOST_TYPEOF_NATIVE :
|
||||
odr_native ] ;
|
||||
all += [ run odr1.cpp odr2.cpp : : : <define>BOOST_TYPEOF_COMPLIANT :
|
||||
all += [ run odr1.cpp odr2.cpp : : : <define>BOOST_TYPEOF_EMULATION :
|
||||
odr_emulation ] ;
|
||||
all += [ run odr_no_uns1.cpp odr_no_uns2.cpp : : : <define>BOOST_TYPEOF_EMULATION :
|
||||
odr_no_uns ] ;
|
||||
return $(all) ;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<void()>::value);
|
||||
|
14
test/function_binding.cpp
Executable file
14
test/function_binding.cpp
Executable file
@ -0,0 +1,14 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// 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/typeof.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
int foo(double);
|
||||
typedef int(&FREF)(double);
|
||||
FREF fref = *foo;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref), int(double)>::value));
|
@ -1,6 +1,19 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
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);
|
||||
|
||||
// check that const gets stripped from function pointer
|
||||
|
||||
int foo(double);
|
||||
typedef int(*PTR)(double);
|
||||
typedef const PTR CPTR;
|
||||
CPTR cptr = foo;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(cptr), PTR>::value));
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// 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/typeof.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<void(&)()>::value);
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<double(*)()>::value);
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 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/typeof/typeof.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
@ -8,7 +12,7 @@ void do_int(int) {}
|
||||
|
||||
struct {
|
||||
template<typename T>
|
||||
T operator[](const T&) {}
|
||||
T operator[](const T& n) {return n;}
|
||||
} int_p;
|
||||
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// boostinspect:nounnamed
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
struct foo
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "odr.hpp"
|
||||
#include <iostream>
|
||||
|
||||
|
@ -1 +1,5 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "odr.hpp"
|
||||
|
20
test/odr_no_uns1.cpp
Executable file
20
test/odr_no_uns1.cpp
Executable file
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Copyright (C) 2006 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 "odr_no_uns1.hpp"
|
||||
#include "odr_no_uns2.hpp"
|
||||
|
||||
void odr_no_uns1()
|
||||
{
|
||||
odr_test_1 t1;
|
||||
odr_test_2 t2;
|
||||
BOOST_AUTO(v1, t1);
|
||||
BOOST_AUTO(v2, t2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
19
test/odr_no_uns1.hpp
Executable file
19
test/odr_no_uns1.hpp
Executable file
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Copyright (C) 2006 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_ODR_NO_UNS1_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_ODR_NO_UNS1_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TYPEOF_SUPPRESS_UNNAMED_NAMESPACE
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
struct odr_test_1
|
||||
{};
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TYPE(odr_test_1)
|
||||
|
||||
#endif//BOOST_TYPEOF_ODR_NO_UNS1_HPP_INCLUDED
|
15
test/odr_no_uns2.cpp
Executable file
15
test/odr_no_uns2.cpp
Executable file
@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Copyright (C) 2006 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 "odr_no_uns2.hpp"
|
||||
#include "odr_no_uns1.hpp"
|
||||
|
||||
void odr_no_uns2()
|
||||
{
|
||||
odr_test_1 t1;
|
||||
odr_test_2 t2;
|
||||
BOOST_AUTO(v1, t1);
|
||||
BOOST_AUTO(v2, t2);
|
||||
}
|
19
test/odr_no_uns2.hpp
Executable file
19
test/odr_no_uns2.hpp
Executable file
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Copyright (C) 2006 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_ODR_NO_UNS2_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_ODR_NO_UNS2_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TYPEOF_SUPPRESS_UNNAMED_NAMESPACE
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
struct odr_test_2
|
||||
{};
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TYPE(odr_test_2)
|
||||
|
||||
#endif//BOOST_TYPEOF_ODR_NO_UNS2_HPP_INCLUDED
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
#include <boost/typeof/std/string.hpp>
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include <climits>
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
|
Reference in New Issue
Block a user