mirror of
https://github.com/boostorg/utility.git
synced 2025-10-12 08:35:21 +02:00
Compare commits
27 Commits
sandbox-br
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
|
9deb4dd823 | ||
|
e3c982287a | ||
|
82e1111bb8 | ||
|
9339b32178 | ||
|
3770221507 | ||
|
e6cb3a77ee | ||
|
bbccfbbab4 | ||
|
74a6a693d3 | ||
|
bf713ad47a | ||
|
76b17c497b | ||
|
3de5974419 | ||
|
7eb1536590 | ||
|
9339431e03 | ||
|
f2349baf7d | ||
|
8745ca628a | ||
|
ba61e9d796 | ||
|
afe74fffbc | ||
|
09a0137016 | ||
|
a1d3ec6c53 | ||
|
5be3004e6c | ||
|
d387905150 | ||
|
b514e40733 | ||
|
b02677375f | ||
|
61a6015b5a | ||
|
682032a340 | ||
|
67afd7e315 | ||
|
75cf20cace |
@@ -85,7 +85,7 @@
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||||
height="31" width="88"></a></p>
|
height="31" width="88"></a></p>
|
||||||
|
|
||||||
<p>Revised
|
<p>Revised
|
||||||
|
@@ -1,31 +0,0 @@
|
|||||||
#----------------------------------------------------------------------------
|
|
||||||
# This file was automatically generated from the original CMakeLists.txt file
|
|
||||||
# Add a variable to hold the headers for the library
|
|
||||||
set (lib_headers
|
|
||||||
assert.hpp
|
|
||||||
call_traits.hpp
|
|
||||||
checked_delete.hpp
|
|
||||||
compressed_pair.hpp
|
|
||||||
current_function.hpp
|
|
||||||
operators.hpp
|
|
||||||
throw_exception.hpp
|
|
||||||
utility.hpp
|
|
||||||
utility
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add a library target to the build system
|
|
||||||
boost_library_project(
|
|
||||||
utility
|
|
||||||
# SRCDIRS
|
|
||||||
TESTDIRS test
|
|
||||||
HEADERS ${lib_headers}
|
|
||||||
# DOCDIRS
|
|
||||||
DESCRIPTION "Various small utilities for C++ programming."
|
|
||||||
MODULARIZED
|
|
||||||
AUTHORS "David Abrahams <dave -at- boostpro.com>"
|
|
||||||
"Brad King"
|
|
||||||
"Douglas Gregor <doug.gregor -at- gmail.com>"
|
|
||||||
# MAINTAINERS
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
@@ -509,7 +509,7 @@ Returns the largest size that this Collection can ever have. <A href="#8">[8]</A
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||||
height="31" width="88"></a></p>
|
height="31" width="88"></a></p>
|
||||||
|
|
||||||
<p>Revised
|
<p>Revised
|
||||||
|
@@ -160,7 +160,7 @@ t.~T()
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||||
height="31" width="88"></a></p>
|
height="31" width="88"></a></p>
|
||||||
|
|
||||||
<p>Revised
|
<p>Revised
|
||||||
|
@@ -185,7 +185,7 @@
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||||
height="31" width="88"></a></p>
|
height="31" width="88"></a></p>
|
||||||
|
|
||||||
<p>Revised
|
<p>Revised
|
||||||
|
@@ -70,7 +70,7 @@
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||||
height="31" width="88"></a></p>
|
height="31" width="88"></a></p>
|
||||||
|
|
||||||
<p>Revised
|
<p>Revised
|
||||||
|
@@ -281,7 +281,7 @@ object_id_compare::operator ()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return a.second->before( *b.second );
|
return a.second->before( *b.second ) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,10 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
|
#ifdef BOOST_MSVC
|
||||||
|
#pragma warning(disable:4996) // warning C4996: 'std::equal': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Note: This file tests every single valid bit-grouping on its own, and some
|
Note: This file tests every single valid bit-grouping on its own, and some
|
||||||
random combinations of bit-groupings.
|
random combinations of bit-groupings.
|
||||||
|
@@ -21,6 +21,10 @@
|
|||||||
#include <libs/type_traits/test/test.hpp>
|
#include <libs/type_traits/test/test.hpp>
|
||||||
#include <libs/type_traits/test/check_type.hpp>
|
#include <libs/type_traits/test/check_type.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_MSVC
|
||||||
|
#pragma warning(disable:4181) // : warning C4181: qualifier applied to reference type; ignored
|
||||||
|
#endif
|
||||||
|
|
||||||
// a way prevent warnings for unused variables
|
// a way prevent warnings for unused variables
|
||||||
template<class T> inline void unused_variable(const T&) {}
|
template<class T> inline void unused_variable(const T&) {}
|
||||||
|
|
||||||
@@ -52,7 +56,8 @@ struct contained
|
|||||||
const_reference const_get()const { return v_; }
|
const_reference const_get()const { return v_; }
|
||||||
// pass value:
|
// pass value:
|
||||||
void call(param_type){}
|
void call(param_type){}
|
||||||
|
private:
|
||||||
|
contained& operator=(const contained&);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
@@ -77,6 +82,8 @@ struct contained<T[N]>
|
|||||||
reference get() { return v_; }
|
reference get() { return v_; }
|
||||||
const_reference const_get()const { return v_; }
|
const_reference const_get()const { return v_; }
|
||||||
void call(param_type){}
|
void call(param_type){}
|
||||||
|
private:
|
||||||
|
contained& operator=(const contained&);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -197,7 +204,7 @@ struct comparible_UDT
|
|||||||
bool operator == (const comparible_UDT& v){ return v.i_ == i_; }
|
bool operator == (const comparible_UDT& v){ return v.i_ == i_; }
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[ ])
|
int main()
|
||||||
{
|
{
|
||||||
call_traits_checker<comparible_UDT> c1;
|
call_traits_checker<comparible_UDT> c1;
|
||||||
comparible_UDT u;
|
comparible_UDT u;
|
||||||
|
@@ -146,7 +146,7 @@ int main()
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
|
||||||
"http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
|
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
|
||||||
height="31" width="88"></a></p>
|
height="31" width="88"></a></p>
|
||||||
|
|
||||||
<p>Revised
|
<p>Revised
|
||||||
|
@@ -117,7 +117,7 @@ The following simplified example shows the basic idea. A complete example follow
|
|||||||
<pre>struct C
|
<pre>struct C
|
||||||
{
|
{
|
||||||
template<class InPlaceFactory>
|
template<class InPlaceFactory>
|
||||||
C ( InPlaceFactory const& aFactoty )
|
C ( InPlaceFactory const& aFactory )
|
||||||
:
|
:
|
||||||
contained_ ( uninitialized_storage() )
|
contained_ ( uninitialized_storage() )
|
||||||
{
|
{
|
||||||
|
@@ -6,14 +6,6 @@
|
|||||||
#ifndef UUID_1D94A7C6054E11DB9804B622A1EF5492
|
#ifndef UUID_1D94A7C6054E11DB9804B622A1EF5492
|
||||||
#define UUID_1D94A7C6054E11DB9804B622A1EF5492
|
#define UUID_1D94A7C6054E11DB9804B622A1EF5492
|
||||||
|
|
||||||
#include <boost/exception/diagnostic_information.hpp>
|
#error The header <boost/exception.hpp> has been deprecated. Please #include <boost/exception/all.hpp> instead.
|
||||||
#include <boost/exception/error_info.hpp>
|
|
||||||
#include <boost/exception/exception.hpp>
|
|
||||||
#include <boost/exception/get_error_info.hpp>
|
|
||||||
#include <boost/exception/info.hpp>
|
|
||||||
#include <boost/exception/info_tuple.hpp>
|
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
|
||||||
#include <boost/exception_ptr.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -27,6 +27,9 @@ template<class T> struct addr_impl_ref
|
|||||||
|
|
||||||
inline addr_impl_ref( T & v ): v_( v ) {}
|
inline addr_impl_ref( T & v ): v_( v ) {}
|
||||||
inline operator T& () const { return v_; }
|
inline operator T& () const { return v_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
addr_impl_ref & operator=(const addr_impl_ref &);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T> struct addressof_impl
|
template<class T> struct addressof_impl
|
||||||
|
@@ -10,7 +10,30 @@
|
|||||||
# error Boost result_of - do not include this file!
|
# error Boost result_of - do not include this file!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BOOST_HAS_DECLTYPE)
|
// CWPro8 requires an argument in a function type specialization
|
||||||
|
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0
|
||||||
|
# define BOOST_RESULT_OF_ARGS void
|
||||||
|
#else
|
||||||
|
# define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||||
|
template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||||
|
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
|
struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||||
|
: mpl::if_<
|
||||||
|
mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
|
||||||
|
, boost::detail::tr1_result_of_impl<
|
||||||
|
typename remove_cv<F>::type,
|
||||||
|
typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
|
||||||
|
(boost::detail::has_result_type<F>::value)>
|
||||||
|
, boost::detail::tr1_result_of_impl<
|
||||||
|
F,
|
||||||
|
F(BOOST_RESULT_OF_ARGS),
|
||||||
|
(boost::detail::has_result_type<F>::value)> >::type { };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_DECLTYPE) && defined(BOOST_RESULT_OF_USE_DECLTYPE)
|
||||||
|
|
||||||
// As of N2588, C++0x result_of only supports function call
|
// As of N2588, C++0x result_of only supports function call
|
||||||
// expressions of the form f(x). This precludes support for member
|
// expressions of the form f(x). This precludes support for member
|
||||||
@@ -21,11 +44,11 @@ template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
|||||||
struct result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
|
struct result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
|
||||||
: mpl::if_<
|
: mpl::if_<
|
||||||
mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
|
mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
|
||||||
, detail::result_of_impl<
|
, detail::tr1_result_of_impl<
|
||||||
typename remove_cv<F>::type,
|
typename remove_cv<F>::type,
|
||||||
typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
|
typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
|
||||||
>
|
>
|
||||||
, detail::result_of_decltype_impl<
|
, detail::cpp0x_result_of_impl<
|
||||||
F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))
|
F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))
|
||||||
>
|
>
|
||||||
>::type
|
>::type
|
||||||
@@ -39,7 +62,7 @@ namespace detail {
|
|||||||
|
|
||||||
template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
class result_of_decltype_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
|
class cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
|
||||||
{
|
{
|
||||||
static F f;
|
static F f;
|
||||||
BOOST_PP_REPEAT(BOOST_PP_ITERATION(), BOOST_RESULT_OF_STATIC_MEMBERS, _)
|
BOOST_PP_REPEAT(BOOST_PP_ITERATION(), BOOST_RESULT_OF_STATIC_MEMBERS, _)
|
||||||
@@ -49,34 +72,18 @@ public:
|
|||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
#else // defined(BOOST_HAS_DECLTYPE)
|
#else // defined(BOOST_NO_DECLTYPE)
|
||||||
|
|
||||||
// CWPro8 requires an argument in a function type specialization
|
|
||||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0
|
|
||||||
# define BOOST_RESULT_OF_ARGS void
|
|
||||||
#else
|
|
||||||
# define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||||
template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||||
: mpl::if_<
|
: tr1_result_of<F(BOOST_RESULT_OF_ARGS)> { };
|
||||||
mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
|
|
||||||
, boost::detail::result_of_impl<
|
|
||||||
typename remove_cv<F>::type,
|
|
||||||
typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
|
|
||||||
(boost::detail::has_result_type<F>::value)>
|
|
||||||
, boost::detail::result_of_impl<
|
|
||||||
F,
|
|
||||||
F(BOOST_RESULT_OF_ARGS),
|
|
||||||
(boost::detail::has_result_type<F>::value)> >::type { };
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef BOOST_RESULT_OF_ARGS
|
#endif // defined(BOOST_NO_DECLTYPE)
|
||||||
|
|
||||||
#endif // defined(BOOST_HAS_DECLTYPE)
|
#undef BOOST_RESULT_OF_ARGS
|
||||||
|
|
||||||
#if BOOST_PP_ITERATION() >= 1
|
#if BOOST_PP_ITERATION() >= 1
|
||||||
|
|
||||||
@@ -84,14 +91,14 @@ namespace detail {
|
|||||||
|
|
||||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
struct result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
struct tr1_result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
||||||
{
|
{
|
||||||
typedef R type;
|
typedef R type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
struct result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
struct tr1_result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
||||||
{
|
{
|
||||||
typedef R type;
|
typedef R type;
|
||||||
};
|
};
|
||||||
@@ -99,7 +106,7 @@ struct result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs
|
|||||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
struct result_of_impl<R (T0::*)
|
struct tr1_result_of_impl<R (T0::*)
|
||||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)),
|
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)),
|
||||||
FArgs, false>
|
FArgs, false>
|
||||||
{
|
{
|
||||||
@@ -108,7 +115,7 @@ struct result_of_impl<R (T0::*)
|
|||||||
|
|
||||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
struct result_of_impl<R (T0::*)
|
struct tr1_result_of_impl<R (T0::*)
|
||||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
||||||
const,
|
const,
|
||||||
FArgs, false>
|
FArgs, false>
|
||||||
@@ -118,7 +125,7 @@ struct result_of_impl<R (T0::*)
|
|||||||
|
|
||||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
struct result_of_impl<R (T0::*)
|
struct tr1_result_of_impl<R (T0::*)
|
||||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
||||||
volatile,
|
volatile,
|
||||||
FArgs, false>
|
FArgs, false>
|
||||||
@@ -128,7 +135,7 @@ struct result_of_impl<R (T0::*)
|
|||||||
|
|
||||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
struct result_of_impl<R (T0::*)
|
struct tr1_result_of_impl<R (T0::*)
|
||||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
||||||
const volatile,
|
const volatile,
|
||||||
FArgs, false>
|
FArgs, false>
|
||||||
|
@@ -30,14 +30,15 @@
|
|||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
template<typename F> struct result_of;
|
template<typename F> struct result_of;
|
||||||
|
template<typename F> struct tr1_result_of; // a TR1-style implementation of result_of
|
||||||
|
|
||||||
#if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
#if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
|
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
|
||||||
|
|
||||||
template<typename F, typename FArgs, bool HasResultType> struct result_of_impl;
|
template<typename F, typename FArgs, bool HasResultType> struct tr1_result_of_impl;
|
||||||
template<typename F> struct result_of_decltype_impl;
|
template<typename F> struct cpp0x_result_of_impl;
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
struct result_of_void_impl
|
struct result_of_void_impl
|
||||||
@@ -60,10 +61,10 @@ struct result_of_void_impl<R (&)(void)>
|
|||||||
// Determine the return type of a function pointer or pointer to member.
|
// Determine the return type of a function pointer or pointer to member.
|
||||||
template<typename F, typename FArgs>
|
template<typename F, typename FArgs>
|
||||||
struct result_of_pointer
|
struct result_of_pointer
|
||||||
: result_of_impl<typename remove_cv<F>::type, FArgs, false> { };
|
: tr1_result_of_impl<typename remove_cv<F>::type, FArgs, false> { };
|
||||||
|
|
||||||
template<typename F, typename FArgs>
|
template<typename F, typename FArgs>
|
||||||
struct result_of_impl<F, FArgs, true>
|
struct tr1_result_of_impl<F, FArgs, true>
|
||||||
{
|
{
|
||||||
typedef typename F::result_type type;
|
typedef typename F::result_type type;
|
||||||
};
|
};
|
||||||
@@ -79,10 +80,10 @@ struct result_of_nested_result : F::template result<FArgs>
|
|||||||
{};
|
{};
|
||||||
|
|
||||||
template<typename F, typename FArgs>
|
template<typename F, typename FArgs>
|
||||||
struct result_of_impl<F, FArgs, false>
|
struct tr1_result_of_impl<F, FArgs, false>
|
||||||
: mpl::if_<is_function_with_no_args<FArgs>,
|
: mpl::if_<is_function_with_no_args<FArgs>,
|
||||||
result_of_void_impl<F>,
|
result_of_void_impl<F>,
|
||||||
result_of_nested_result<F, FArgs> >::type
|
result_of_nested_result<F, FArgs> >::type
|
||||||
{};
|
{};
|
||||||
|
|
||||||
} // end namespace detail
|
} // end namespace detail
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
boost_module(utility DEPENDS iterator exception detail )
|
|
@@ -132,18 +132,18 @@
|
|||||||
class MyInt
|
class MyInt
|
||||||
: boost::operators<MyInt>
|
: boost::operators<MyInt>
|
||||||
{
|
{
|
||||||
bool operator<(const MyInt& x) const;
|
bool operator<(const MyInt& x) const;
|
||||||
bool operator==(const MyInt& x) const;
|
bool operator==(const MyInt& x) const;
|
||||||
MyInt& operator+=(const MyInt& x);
|
MyInt& operator+=(const MyInt& x);
|
||||||
MyInt& operator-=(const MyInt& x);
|
MyInt& operator-=(const MyInt& x);
|
||||||
MyInt& operator*=(const MyInt& x);
|
MyInt& operator*=(const MyInt& x);
|
||||||
MyInt& operator/=(const MyInt& x);
|
MyInt& operator/=(const MyInt& x);
|
||||||
MyInt& operator%=(const MyInt& x);
|
MyInt& operator%=(const MyInt& x);
|
||||||
MyInt& operator|=(const MyInt& x);
|
MyInt& operator|=(const MyInt& x);
|
||||||
MyInt& operator&=(const MyInt& x);
|
MyInt& operator&=(const MyInt& x);
|
||||||
MyInt& operator^=(const MyInt& x);
|
MyInt& operator^=(const MyInt& x);
|
||||||
MyInt& operator++();
|
MyInt& operator++();
|
||||||
MyInt& operator--();
|
MyInt& operator--();
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
@@ -345,7 +345,7 @@ class MyInt
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>As Daniel Krügler pointed out, this technique violates 14.6.5/2
|
<p>As Daniel Krügler pointed out, this technique violates 14.6.5/2
|
||||||
and is thus non-portable. The reasoning is, that the operators injected
|
and is thus non-portable. The reasoning is, that the operators injected
|
||||||
by the instantiation of e.g.
|
by the instantiation of e.g.
|
||||||
<code>less_than_comparable<myclass></code> can not be found
|
<code>less_than_comparable<myclass></code> can not be found
|
||||||
by ADL according to the rules given by 3.4.2/2, since myclass is
|
by ADL according to the rules given by 3.4.2/2, since myclass is
|
||||||
@@ -445,6 +445,9 @@ const point<float> pi_over_4_normalized = pi_over_4 / length(pi_over_4);
|
|||||||
optional template parameter <code>B</code>, which is not shown, for the
|
optional template parameter <code>B</code>, which is not shown, for the
|
||||||
<a href="#chaining">base class chaining</a> technique.</p>
|
<a href="#chaining">base class chaining</a> technique.</p>
|
||||||
|
|
||||||
|
<p>The primary operand type <code>T</code> needs to be of class type,
|
||||||
|
built-in types are not supported.</p>
|
||||||
|
|
||||||
<table cellpadding="5" border="1" align="center">
|
<table cellpadding="5" border="1" align="center">
|
||||||
<caption>
|
<caption>
|
||||||
Simple Arithmetic Operator Template Classes
|
Simple Arithmetic Operator Template Classes
|
||||||
@@ -917,7 +920,7 @@ T operator+( const T& lhs, const T& rhs )
|
|||||||
created, <code>operator+=</code> is called on it and it is copied to the
|
created, <code>operator+=</code> is called on it and it is copied to the
|
||||||
function return value (which is another unnamed object of type
|
function return value (which is another unnamed object of type
|
||||||
<code>T</code>). The standard doesn't generally allow the intermediate
|
<code>T</code>). The standard doesn't generally allow the intermediate
|
||||||
object to be optimized away:
|
object to be optimized away:
|
||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
3.7.2/2: Automatic storage duration<br>
|
3.7.2/2: Automatic storage duration<br>
|
||||||
@@ -928,7 +931,7 @@ T operator+( const T& lhs, const T& rhs )
|
|||||||
unused, except that a class object or its copy may be eliminated as
|
unused, except that a class object or its copy may be eliminated as
|
||||||
specified in 12.8.
|
specified in 12.8.
|
||||||
</blockquote>
|
</blockquote>
|
||||||
The reference to 12.8 is important for us:
|
The reference to 12.8 is important for us:
|
||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
12.8/15: Copying class objects<br>
|
12.8/15: Copying class objects<br>
|
||||||
@@ -942,7 +945,7 @@ T operator+( const T& lhs, const T& rhs )
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
This optimization is known as the named return value optimization (NRVO),
|
This optimization is known as the named return value optimization (NRVO),
|
||||||
which leads us to the following implementation for
|
which leads us to the following implementation for
|
||||||
<code>operator+</code>:
|
<code>operator+</code>:
|
||||||
<pre>
|
<pre>
|
||||||
T operator+( const T& lhs, const T& rhs )
|
T operator+( const T& lhs, const T& rhs )
|
||||||
{
|
{
|
||||||
@@ -956,7 +959,7 @@ T operator+( const T& lhs, const T& rhs )
|
|||||||
even implement it in an incorrect way which makes it useless here.
|
even implement it in an incorrect way which makes it useless here.
|
||||||
Without the NRVO, the NRVO-friendly code is no worse than the original
|
Without the NRVO, the NRVO-friendly code is no worse than the original
|
||||||
code showed above, but there is another possible implementation, which
|
code showed above, but there is another possible implementation, which
|
||||||
has some very special properties:
|
has some very special properties:
|
||||||
<pre>
|
<pre>
|
||||||
T operator+( T lhs, const T& rhs )
|
T operator+( T lhs, const T& rhs )
|
||||||
{
|
{
|
||||||
@@ -982,7 +985,7 @@ T operator+( T lhs, const T& rhs )
|
|||||||
will force the NRVO-friendly implementation to be used even for compilers
|
will force the NRVO-friendly implementation to be used even for compilers
|
||||||
that don't implement the NRVO. <br>
|
that don't implement the NRVO. <br>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<h3><a name="grpd_oprs">Grouped Arithmetic Operators</a></h3>
|
<h3><a name="grpd_oprs">Grouped Arithmetic Operators</a></h3>
|
||||||
|
|
||||||
<p>The following templates provide common groups of related operations.
|
<p>The following templates provide common groups of related operations.
|
||||||
@@ -1864,7 +1867,7 @@ T operator+( T lhs, const T& rhs )
|
|||||||
V, D, P, R></a></code></td>
|
V, D, P, R></a></code></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
Supports the operations and has the requirements of
|
Supports the operations and has the requirements of
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><code><a href="#input_iteratable">input_iteratable<T,
|
<li><code><a href="#input_iteratable">input_iteratable<T,
|
||||||
@@ -1878,7 +1881,7 @@ T operator+( T lhs, const T& rhs )
|
|||||||
"output_iterator_helper">output_iterator_helper<T></a></code></td>
|
"output_iterator_helper">output_iterator_helper<T></a></code></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
Supports the operations and has the requirements of
|
Supports the operations and has the requirements of
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><code><a href=
|
<li><code><a href=
|
||||||
@@ -1894,7 +1897,7 @@ T operator+( T lhs, const T& rhs )
|
|||||||
R></a></code></td>
|
R></a></code></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
Supports the operations and has the requirements of
|
Supports the operations and has the requirements of
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><code><a href="#forward_iteratable">forward_iteratable<T,
|
<li><code><a href="#forward_iteratable">forward_iteratable<T,
|
||||||
@@ -1909,7 +1912,7 @@ T operator+( T lhs, const T& rhs )
|
|||||||
V, D, P, R></a></code></td>
|
V, D, P, R></a></code></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
Supports the operations and has the requirements of
|
Supports the operations and has the requirements of
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><code><a href=
|
<li><code><a href=
|
||||||
@@ -1925,7 +1928,7 @@ T operator+( T lhs, const T& rhs )
|
|||||||
V, D, P, R></a></code></td>
|
V, D, P, R></a></code></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
Supports the operations and has the requirements of
|
Supports the operations and has the requirements of
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><code><a href=
|
<li><code><a href=
|
||||||
@@ -1976,8 +1979,8 @@ struct function_output_iterator
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
function_output_iterator& operator=(T const& value)
|
function_output_iterator& operator=(T const& value)
|
||||||
{
|
{
|
||||||
this->func(value);
|
this->func(value);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -2130,8 +2133,8 @@ public:
|
|||||||
<p>Revised: 7 Aug 2008</p>
|
<p>Revised: 7 Aug 2008</p>
|
||||||
|
|
||||||
<p>Copyright © Beman Dawes, David Abrahams, 1999-2001.</p>
|
<p>Copyright © Beman Dawes, David Abrahams, 1999-2001.</p>
|
||||||
<p>Copyright © Daniel Frey, 2002-2008.</p>
|
<p>Copyright © Daniel Frey, 2002-2009.</p>
|
||||||
<p>Use, modification, and distribution is subject to the Boost Software
|
<p>Use, modification, and distribution is subject to the Boost Software
|
||||||
License, Version 1.0. (See accompanying file
|
License, Version 1.0. (See accompanying file
|
||||||
<a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at
|
<a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at
|
||||||
<a href="http://www.boost.org/LICENSE_1_0.txt">
|
<a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||||
|
@@ -70,7 +70,7 @@ struct ref_wrapper
|
|||||||
|
|
||||||
struct copy_counter {
|
struct copy_counter {
|
||||||
static int count_;
|
static int count_;
|
||||||
copy_counter(copy_counter const& other) {
|
copy_counter(copy_counter const& /*other*/) {
|
||||||
++count_;
|
++count_;
|
||||||
}
|
}
|
||||||
copy_counter() {}
|
copy_counter() {}
|
||||||
|
@@ -7,7 +7,11 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- Page header -->
|
<!-- Page header -->
|
||||||
|
<h2>
|
||||||
<img src="../../boost.png" alt="C++ Boost" align="middle" width="277" height="86"/>
|
<img src="../../boost.png" alt="C++ Boost" align="middle" width="277" height="86"/>
|
||||||
|
Header <<a href="../../boost/swap.hpp">boost/swap.hpp</a>>
|
||||||
|
</h2>
|
||||||
|
|
||||||
<h1>Swap</h1>
|
<h1>Swap</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -84,9 +88,9 @@
|
|||||||
|
|
||||||
<!-- Copyright info -->
|
<!-- Copyright info -->
|
||||||
<hr/>
|
<hr/>
|
||||||
<p>Revised: 15 November 2008</p>
|
<p>Revised: 08 September 2009</p>
|
||||||
<p>
|
<p>
|
||||||
Copyright 2007, 2008 Joseph Gauterin. Use, modification, and distribution are subject to the Boost Software License, Version 1.0.
|
Copyright 2007 - 2009 Joseph Gauterin. Use, modification, and distribution are subject to the Boost Software License, Version 1.0.
|
||||||
(See accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>>.)
|
(See accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>>.)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
// Copyright (c) 2008 - 2010 Joseph Gauterin, Niels Dekker
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@@ -17,9 +17,9 @@
|
|||||||
int test_main(int, char*[])
|
int test_main(int, char*[])
|
||||||
{
|
{
|
||||||
typedef std::bitset<8> bitset_type;
|
typedef std::bitset<8> bitset_type;
|
||||||
const bitset_type initial_value1 = 1ul;
|
const bitset_type initial_value1 = 1;
|
||||||
const bitset_type initial_value2 = 2ul;
|
const bitset_type initial_value2 = 2;
|
||||||
|
|
||||||
bitset_type object1 = initial_value1;
|
bitset_type object1 = initial_value1;
|
||||||
bitset_type object2 = initial_value2;
|
bitset_type object2 = initial_value2;
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
class swap_test_class
|
class swap_test_class
|
||||||
{
|
{
|
||||||
int m_data;
|
int m_data;
|
||||||
public:
|
public:
|
||||||
explicit swap_test_class(int arg = 0)
|
explicit swap_test_class(int arg = 0)
|
||||||
:
|
:
|
||||||
|
@@ -1,38 +0,0 @@
|
|||||||
boost_additional_test_dependencies(utility BOOST_DEPENDS test)
|
|
||||||
|
|
||||||
boost_test_run(addressof_test ../addressof_test.cpp)
|
|
||||||
boost_test_run(assert_test ../assert_test.cpp)
|
|
||||||
boost_test_run(base_from_member_test ../base_from_member_test.cpp)
|
|
||||||
boost_test_run(binary_search_test ../binary_search_test.cpp)
|
|
||||||
boost_test_run(call_traits_test ../call_traits_test.cpp ARGS -u)
|
|
||||||
boost_test_compile_fail(checked_delete_test ../checked_delete_test.cpp)
|
|
||||||
boost_test_run(compressed_pair_test
|
|
||||||
../compressed_pair_test
|
|
||||||
DEPENDS boost_test_exec_monitor)
|
|
||||||
boost_test_run(current_function_test ../current_function_test.cpp)
|
|
||||||
boost_test_run(iterators_test
|
|
||||||
../iterators_test.cpp
|
|
||||||
DEPENDS boost_test_exec_monitor)
|
|
||||||
boost_test_run(next_prior_test DEPENDS boost_test_exec_monitor)
|
|
||||||
boost_test_compile_fail(noncopyable_test ../noncopyable_test.cpp)
|
|
||||||
boost_test_run(numeric_traits_test ../numeric_traits_test.cpp)
|
|
||||||
if (${CMAKE_SYSTEM} MATCHES "FreeBSD-.*")
|
|
||||||
boost_test_compile_fail("operators_test_compilerbug")
|
|
||||||
elseif(${CMAKE_SYSTEM} MATCHES "FreeBSD-.*")
|
|
||||||
boost_test_run(operators_test
|
|
||||||
../operators_test.cpp
|
|
||||||
DEPENDS boost_test_exec_monitor)
|
|
||||||
endif(${CMAKE_SYSTEM} MATCHES "FreeBSD-.*")
|
|
||||||
boost_test_compile(ref_ct_test ../ref_ct_test.cpp)
|
|
||||||
boost_test_run(ref_test
|
|
||||||
../ref_test.cpp
|
|
||||||
DEPENDS boost_test_exec_monitor)
|
|
||||||
boost_test_compile(result_of_test)
|
|
||||||
boost_test_run(shared_iterator_test ../shared_iterator_test.cpp)
|
|
||||||
boost_test_run(value_init_test ../value_init_test.cpp)
|
|
||||||
boost_test_compile_fail(value_init_test_fail1
|
|
||||||
../value_init_test_fail1.cpp)
|
|
||||||
boost_test_compile_fail(value_init_test_fail2
|
|
||||||
../value_init_test_fail2.cpp)
|
|
||||||
boost_test_compile_fail(value_init_test_fail3
|
|
||||||
../value_init_test_fail3.cpp)
|
|
0
test/next_prior_test.cpp
Executable file → Normal file
0
test/next_prior_test.cpp
Executable file → Normal file
@@ -5,6 +5,8 @@
|
|||||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#define BOOST_RESULT_OF_USE_DECLTYPE
|
||||||
|
|
||||||
// For more information, see http://www.boost.org/libs/utility
|
// For more information, see http://www.boost.org/libs/utility
|
||||||
#include <boost/utility/result_of.hpp>
|
#include <boost/utility/result_of.hpp>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@@ -131,9 +133,21 @@ int main()
|
|||||||
BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(double)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(double)>::type, int>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<const int_result_of_template<void>(double)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<const int_result_of_template<void>(double)>::type, int>::value));
|
||||||
|
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type(float)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_of(double)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<const int_result_of(double)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type_template<void>(float)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_of_template<void>(double)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<const int_result_of_template<void>(double)>::type, int>::value));
|
||||||
|
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_of(void)>::type, void>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<volatile int_result_of(void)>::type, void>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_of_template<void>(void)>::type, void>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<volatile int_result_of_template<void>(void)>::type, void>::value));
|
||||||
|
|
||||||
// Prior to decltype, result_of could not deduce the return type
|
// Prior to decltype, result_of could not deduce the return type
|
||||||
// nullary function objects unless they exposed a result_type.
|
// nullary function objects unless they exposed a result_type.
|
||||||
#if defined(BOOST_HAS_DECLTYPE)
|
#if !defined(BOOST_NO_DECLTYPE)
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(void)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(void)>::type, int>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of(void)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of(void)>::type, int>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(void)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(void)>::type, int>::value));
|
||||||
@@ -145,11 +159,14 @@ int main()
|
|||||||
BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of_template<void>(void)>::type, void>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of_template<void>(void)>::type, void>::value));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, int>::value));
|
||||||
|
|
||||||
// Prior to decltype, result_of ignored a nested result<> if
|
// Prior to decltype, result_of ignored a nested result<> if
|
||||||
// result_type was defined. After decltype, result_of deduces the
|
// result_type was defined. After decltype, result_of deduces the
|
||||||
// actual return type of the function object, ignoring both
|
// actual return type of the function object, ignoring both
|
||||||
// result<> and result_type.
|
// result<> and result_type.
|
||||||
#if defined(BOOST_HAS_DECLTYPE)
|
#if !defined(BOOST_NO_DECLTYPE)
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, char>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, char>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, char>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, char>::value));
|
||||||
#else
|
#else
|
||||||
@@ -168,6 +185,17 @@ int main()
|
|||||||
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_0(X)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_0(X)>::type, int>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<func_ptr(void)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<func_ptr(void)>::type, int>::value));
|
||||||
|
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr(char, float)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref(char, float)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr_0()>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref_0()>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr(X,char)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_c(X,char)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_v(X,char)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_cv(X,char)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_0(X)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr(void)>::type, int>::value));
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(double)>::type, double>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(double)>::type, double>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<const result_of_member_function_template(double)>::type, const double>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<const result_of_member_function_template(double)>::type, const double>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<volatile result_of_member_function_template(double)>::type, volatile double>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<volatile result_of_member_function_template(double)>::type, volatile double>::value));
|
||||||
@@ -177,11 +205,23 @@ int main()
|
|||||||
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int volatile &, int)>::type, int volatile &>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int volatile &, int)>::type, int volatile &>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int const volatile &, int)>::type, int const volatile &>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int const volatile &, int)>::type, int const volatile &>::value));
|
||||||
|
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(double)>::type, double>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<const result_of_member_function_template(double)>::type, const double>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<volatile result_of_member_function_template(double)>::type, volatile double>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<const volatile result_of_member_function_template(double)>::type, const volatile double>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int &, int)>::type, int &>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int const &, int)>::type, int const &>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int volatile &, int)>::type, int volatile &>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int const volatile &, int)>::type, int const volatile &>::value));
|
||||||
|
|
||||||
typedef int (*pf_t)(int);
|
typedef int (*pf_t)(int);
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<pf_t(int)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<pf_t(int)>::type, int>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<pf_t const(int)>::type,int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<pf_t const(int)>::type,int>::value));
|
||||||
|
|
||||||
#if defined(BOOST_HAS_DECLTYPE)
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<pf_t(int)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<tr1_result_of<pf_t const(int)>::type,int>::value));
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_DECLTYPE)
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(double)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(double)>::type, int>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(void)>::type, unsigned int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(void)>::type, unsigned int>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result_of(double)>::type, short>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result_of(double)>::type, short>::value));
|
||||||
|
@@ -313,7 +313,7 @@ non-member function <code>get()</code>: </p>
|
|||||||
|
|
||||||
<h3>Warning:</h3>
|
<h3>Warning:</h3>
|
||||||
|
|
||||||
<p>The <code>value_initialized</code> implementation of Boost version 1.38.0 and older
|
<p>The <code>value_initialized</code> implementation of Boost version 1.40.0 and older
|
||||||
allowed <i>non-const</i> access to the wrapped object, from a constant wrapper,
|
allowed <i>non-const</i> access to the wrapped object, from a constant wrapper,
|
||||||
both by its conversion operator and its <code>data()</code> member function. For example:</p>
|
both by its conversion operator and its <code>data()</code> member function. For example:</p>
|
||||||
|
|
||||||
@@ -407,7 +407,7 @@ for Boost release version 1.35 (2008), offering a workaround to various compiler
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<p>Revised 20 February 2009</p>
|
<p>Revised 03 October 2009</p>
|
||||||
|
|
||||||
<p>© Copyright Fernando Cacciola, 2002, 2009.</p>
|
<p>© Copyright Fernando Cacciola, 2002, 2009.</p>
|
||||||
|
|
||||||
@@ -418,4 +418,4 @@ for Boost release version 1.35 (2008), offering a workaround to various compiler
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -29,9 +29,9 @@
|
|||||||
//
|
//
|
||||||
struct POD
|
struct POD
|
||||||
{
|
{
|
||||||
POD () : c(0), i(0), f(0) {}
|
POD () : f(0), c(0), i(0){}
|
||||||
|
|
||||||
POD ( char c_, int i_, float f_ ) : c(c_), i(i_), f(f_) {}
|
POD ( char c_, int i_, float f_ ) : f(f_), c(c_), i(i_) {}
|
||||||
|
|
||||||
friend std::ostream& operator << ( std::ostream& os, POD const& pod )
|
friend std::ostream& operator << ( std::ostream& os, POD const& pod )
|
||||||
{ return os << '(' << pod.c << ',' << pod.i << ',' << pod.f << ')' ; }
|
{ return os << '(' << pod.c << ',' << pod.i << ',' << pod.f << ')' ; }
|
||||||
@@ -291,7 +291,7 @@ int test_main(int, char **)
|
|||||||
{
|
{
|
||||||
BOOST_CHECK ( test( 0,1234 ) ) ;
|
BOOST_CHECK ( test( 0,1234 ) ) ;
|
||||||
BOOST_CHECK ( test( 0.0,12.34 ) ) ;
|
BOOST_CHECK ( test( 0.0,12.34 ) ) ;
|
||||||
BOOST_CHECK ( test( POD(0,0,0.0), POD('a',1234,56.78) ) ) ;
|
BOOST_CHECK ( test( POD(0,0,0.0), POD('a',1234,56.78f) ) ) ;
|
||||||
BOOST_CHECK ( test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ) ;
|
BOOST_CHECK ( test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ) ;
|
||||||
|
|
||||||
NonPOD NonPOD_object( std::string("NonPOD_object") );
|
NonPOD NonPOD_object( std::string("NonPOD_object") );
|
||||||
|
Reference in New Issue
Block a user