Compare commits

...

32 Commits

Author SHA1 Message Date
cf864881e8 This commit was manufactured by cvs2svn to create tag
'Version_1_34_0_RC1'.

[SVN r37644]
2007-05-09 04:40:54 +00:00
f7df17a93a Merged doc fix
[SVN r37564]
2007-05-02 20:03:05 +00:00
ed21868c25 tutorial text fix
[SVN r36898]
2007-02-06 01:50:40 +00:00
c66289f7ac From HEAD: Added documentation: BOOST_TYPEOF_NESTED_TYPEDEF can not be used at function/block scope
[SVN r36886]
2007-02-04 09:29:20 +00:00
43b4d4522c Remove obsolete Boost.Build v1 files.
[SVN r35880]
2006-11-06 17:10:46 +00:00
8868adc891 Merged from HEAD: Changed specialization of encode_integral for bool to work around issues with the sun compiler
[SVN r35135]
2006-09-16 17:36:03 +00:00
452b493b7a merged suppress inspection complain about unnamed ns
[SVN r35119]
2006-09-15 02:19:55 +00:00
eeff4e592c Merged supress inspection unnamed namespace
[SVN r35118]
2006-09-15 02:11:47 +00:00
1b65bfc95d Merged from HEAD: Fixed warnings on VC7.1 on integral encoding of bool
[SVN r35110]
2006-09-14 17:39:57 +00:00
eda5c4afba Merged from HEAD: Added name to copyright.
[SVN r35060]
2006-09-10 17:43:17 +00:00
340148f738 merged removed tab
[SVN r35057]
2006-09-10 16:55:21 +00:00
64ba3be86f merged inspection report fixes
[SVN r35053]
2006-09-09 17:43:02 +00:00
d337b0837a This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r35052]
2006-09-09 17:25:10 +00:00
dddbb00da4 Merged from HEAD: DMC support for BOOST_TYPEOF_NESTED_TYPEDEF
[SVN r35049]
2006-09-08 16:21:49 +00:00
935b36d8f5 Merged from HEAD: Support typeof emulation for DMC: Integral argument support.
[SVN r35024]
2006-09-06 17:12:45 +00:00
5bd010787a Fixed issues with support for compilers without SFINAE
[SVN r35017]
2006-09-01 19:25:45 +00:00
55ac93f947 Merged from HEAD Fixed error in code for supporting compilers without SFINAE.
[SVN r35012]
2006-08-31 11:00:14 +00:00
366ab1b621 Merged from HEAD: Disable enable_if for compiler that does not support it.
[SVN r35000]
2006-08-30 17:18:13 +00:00
aede9c2866 Remove tabs
[SVN r34996]
2006-08-29 21:14:51 +00:00
2b92bbcb21 Merged from HEAD, Fixed issue with BOOST_TYPEOF_NESTED_TYPEDEF for CW in emulation mode
[SVN r34983]
2006-08-28 16:57:08 +00:00
dff8a5c505 boost guidelines (mainly from inspect tool: tabs, license reference text, etc.); more to do...
[SVN r34753]
2006-07-27 11:48:49 +00:00
a460694e5d *** empty log message ***
[SVN r34402]
2006-06-25 23:59:21 +00:00
db9203fb0e merged SUPPRESS_UNNAMED_NAMESPACE
[SVN r34348]
2006-06-18 15:43:26 +00:00
9a14e20bc5 *** empty log message ***
[SVN r34270]
2006-06-11 12:05:52 +00:00
47a4b2a2c1 *** empty log message ***
[SVN r34215]
2006-06-07 03:00:58 +00:00
337fe1fdf6 merged function binding
[SVN r34177]
2006-06-05 02:50:05 +00:00
11b18afcce merged function binding
[SVN r34176]
2006-06-05 02:43:08 +00:00
7cbdf2406a Merged fix for VC PCH
[SVN r33800]
2006-04-25 00:57:46 +00:00
97b9bda347 merged typeof doc id
[SVN r33770]
2006-04-23 12:44:00 +00:00
041f9cfd24 Merged typo in typeof doc from HEAD
[SVN r33525]
2006-03-29 17:36:53 +00:00
c17f725e5f Merged doc fix for BOOST_TYPEOF_NESTED_TYPEDEF (removal of tabs in doc) from HEAD
[SVN r33461]
2006-03-23 20:54:37 +00:00
35874c8e32 This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r33417]
2006-03-21 02:26:31 +00:00
48 changed files with 519 additions and 315 deletions

View File

@ -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(),

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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));

View File

@ -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

View File

@ -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
View 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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

View File

@ -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;\

View File

@ -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())

View File

@ -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));

View File

@ -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

View File

@ -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

View File

@ -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">

View File

@ -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 ]
;

View File

@ -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) ;
}

View File

@ -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()

View File

@ -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
View 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));

View File

@ -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));

View File

@ -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>

View File

@ -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);

View File

@ -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);

View File

@ -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()

View File

@ -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;

View File

@ -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()

View File

@ -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

View File

@ -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>

View File

@ -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
View 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
View 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
View 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
View 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

View File

@ -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>

View File

@ -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()

View File

@ -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()

View File

@ -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>

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()