Compare commits

..

2 Commits

Author SHA1 Message Date
nobody
f97298f1e1 This commit was manufactured by cvs2svn to create tag
'Version_1_27_0'.

[SVN r12749]
2002-02-07 13:33:59 +00:00
nobody
6f105dcc3b This commit was manufactured by cvs2svn to create branch 'RC_1_27_0'.
[SVN r12739]
2002-02-06 03:32:50 +00:00
9 changed files with 48 additions and 115 deletions

View File

@@ -57,7 +57,7 @@ struct object_id_compare
// A singleton of this type coordinates the acknowledgements
// of objects being created and used.
class object_registrar
: private boost::noncopyable
: boost::noncopyable
{
public:

View File

@@ -6,8 +6,6 @@
// warranty, and with no claim as to its suitability for any purpose.
// standalone test program for <boost/call_traits.hpp>
// 18 Mar 2002:
// Changed some names to prevent conflicts with some new type_traits additions.
// 03 Oct 2000:
// Enabled extra tests for VC6.
@@ -80,7 +78,7 @@ struct contained<T[N]>
#endif
template <class T>
contained<typename boost::call_traits<T>::value_type> test_wrap_type(const T& t)
contained<typename boost::call_traits<T>::value_type> wrap(const T& t)
{
typedef typename boost::call_traits<T>::value_type ct;
return contained<ct>(t);
@@ -219,9 +217,9 @@ int main(int argc, char *argv[ ])
#endif
#endif
check_wrap(test_wrap_type(2), 2);
check_wrap(wrap(2), 2);
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__SUNPRO_CC)
check_wrap(test_wrap_type(a), a);
check_wrap(wrap(a), a);
check_make_pair(test::make_pair(a, a), a, a);
#endif
@@ -247,7 +245,7 @@ int main(int argc, char *argv[ ])
type_test(int&, boost::call_traits<int&>::reference)
type_test(const int&, boost::call_traits<int&>::const_reference)
type_test(int&, boost::call_traits<int&>::param_type)
#if !(defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))
#if !(defined(__GNUC__) && (__GNUC__ < 4))
type_test(int&, boost::call_traits<cr_type>::value_type)
type_test(int&, boost::call_traits<cr_type>::reference)
type_test(const int&, boost::call_traits<cr_type>::const_reference)
@@ -270,26 +268,16 @@ int main(int argc, char *argv[ ])
type_test(const int(&)[3], boost::call_traits<const int[3]>::reference)
type_test(const int(&)[3], boost::call_traits<const int[3]>::const_reference)
type_test(const int*const, boost::call_traits<const int[3]>::param_type)
// test with abstract base class:
type_test(test_abc1, boost::call_traits<test_abc1>::value_type)
type_test(test_abc1&, boost::call_traits<test_abc1>::reference)
type_test(const test_abc1&, boost::call_traits<test_abc1>::const_reference)
type_test(const test_abc1&, boost::call_traits<test_abc1>::param_type)
#else
std::cout << "You're compiler does not support partial template specialiation, skipping 8 tests (8 errors)" << std::endl;
failures += 12;
test_count += 12;
std::cout << "You're compiler does not support partial template instantiation, skipping 8 tests (8 errors)" << std::endl;
failures += 8;
test_count += 8;
#endif
#else
std::cout << "You're compiler does not support partial template specialiation, skipping 20 tests (20 errors)" << std::endl;
failures += 24;
test_count += 24;
std::cout << "You're compiler does not support partial template instantiation, skipping 20 tests (20 errors)" << std::endl;
failures += 20;
test_count += 20;
#endif
// test with an incomplete type:
type_test(incomplete_type, boost::call_traits<incomplete_type>::value_type)
type_test(incomplete_type&, boost::call_traits<incomplete_type>::reference)
type_test(const incomplete_type&, boost::call_traits<incomplete_type>::const_reference)
type_test(const incomplete_type&, boost::call_traits<incomplete_type>::param_type)
return check_result(argc, argv);
}
@@ -409,22 +397,26 @@ template struct call_traits_test<int[2], true>;
#endif
#ifdef BOOST_MSVC
unsigned int expected_failures = 14;
unsigned int expected_failures = 10;
#elif defined(__SUNPRO_CC)
#if(__SUNPRO_CC <= 0x520)
unsigned int expected_failures = 18;
#elif(__SUNPRO_CC < 0x530)
unsigned int expected_failures = 17;
unsigned int expected_failures = 14;
#elif(__SUNPRO_CC <= 0x530)
unsigned int expected_failures = 13;
#else
unsigned int expected_failures = 6;
#endif
#elif defined(__BORLANDC__)
unsigned int expected_failures = 2;
#elif (defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))
#elif defined(__GNUC__)
unsigned int expected_failures = 4;
#elif defined(__HP_aCC)
unsigned int expected_failures = 24;
unsigned int expected_failures = 20;
#else
unsigned int expected_failures = 0;
#endif

View File

@@ -44,6 +44,19 @@ template<class T> struct checked_deleter
}
};
// checked_deleter<void> is needed by shared_ptr<void>::reset(0)
template<> struct checked_deleter<void>
{
typedef void result_type;
typedef void * argument_type;
void operator()(void * x)
{
::operator delete(x); // avoid g++ warning
}
};
template<class T> struct checked_array_deleter
{
typedef void result_type;

View File

@@ -34,32 +34,20 @@ namespace boost{
namespace detail{
template <typename T, bool small_>
struct ct_imp2
{
typedef const T& param_type;
};
template <typename T>
struct ct_imp2<T, true>
{
typedef const T param_type;
};
template <typename T, bool isp, bool b1>
template <typename T, bool isp, bool b1, bool b2>
struct ct_imp
{
typedef const T& param_type;
};
template <typename T, bool isp>
struct ct_imp<T, isp, true>
struct ct_imp<T, isp, true, true>
{
typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
typedef T const param_type;
};
template <typename T, bool b1>
struct ct_imp<T, true, b1>
template <typename T, bool b1, bool b2>
struct ct_imp<T, true, b1, b2>
{
typedef T const param_type;
};
@@ -79,11 +67,7 @@ public:
// however compiler bugs prevent this - instead pass three bool's to
// ct_imp<T,bool,bool,bool> and add an extra partial specialisation
// of ct_imp to handle the logic. (JM)
typedef typename detail::ct_imp<
T,
::boost::is_pointer<T>::value,
::boost::is_arithmetic<T>::value
>::param_type param_type;
typedef typename detail::ct_imp<T, ::boost::is_pointer<typename remove_const<T>::type>::value, ::boost::is_arithmetic<typename remove_const<T>::type>::value, sizeof(T) <= sizeof(void*)>::param_type param_type;
};
template <typename T>

View File

@@ -64,8 +64,7 @@ struct reference_call_traits
typedef T const_reference;
typedef T param_type;
};
template <bool pointer, bool arithmetic, bool reference>
template <bool simple, bool reference>
struct call_traits_chooser
{
template <class T>
@@ -74,9 +73,8 @@ struct call_traits_chooser
typedef standard_call_traits<T> type;
};
};
template <>
struct call_traits_chooser<true, false, false>
struct call_traits_chooser<true, false>
{
template <class T>
struct rebind
@@ -84,9 +82,8 @@ struct call_traits_chooser<true, false, false>
typedef simple_call_traits<T> type;
};
};
template <>
struct call_traits_chooser<false, false, true>
struct call_traits_chooser<false, true>
{
template <class T>
struct rebind
@@ -94,52 +91,14 @@ struct call_traits_chooser<false, false, true>
typedef reference_call_traits<T> type;
};
};
template <bool size_is_small>
struct call_traits_sizeof_chooser2
{
template <class T>
struct small_rebind
{
typedef simple_call_traits<T> small_type;
};
};
template<>
struct call_traits_sizeof_chooser2<false>
{
template <class T>
struct small_rebind
{
typedef standard_call_traits<T> small_type;
};
};
template <>
struct call_traits_chooser<false, true, false>
{
template <class T>
struct rebind
{
enum { sizeof_choice = (sizeof(T) <= sizeof(void*)) };
typedef call_traits_sizeof_chooser2<(sizeof(T) <= sizeof(void*))> chooser;
typedef typename chooser::template small_rebind<T> bound_type;
typedef typename bound_type::small_type type;
};
};
} // namespace detail
template <typename T>
struct call_traits
{
private:
typedef detail::call_traits_chooser<
::boost::is_pointer<T>::value,
::boost::is_arithmetic<T>::value,
::boost::is_reference<T>::value
> chooser;
typedef typename chooser::template rebind<T> bound_type;
typedef typename bound_type::type call_traits_type;
typedef detail::call_traits_chooser<(is_pointer<T>::value || is_arithmetic<T>::value) && sizeof(T) <= sizeof(void*), is_reference<T>::value> chooser;
typedef typename chooser::template rebind<T> bound_type;
typedef typename bound_type::type call_traits_type;
public:
typedef typename call_traits_type::value_type value_type;
typedef typename call_traits_type::reference reference;

View File

@@ -12,7 +12,6 @@
//
// Copyright (C) 1999, 2000 Jaakko J<>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2001 Peter Dimov
// Copyright (C) 2002 David Abrahams
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.

View File

@@ -92,8 +92,6 @@
<li><a href="#declaration_synopsis">Declaration Synopsis</a>
<li><a href="#portability">Portability</a>
<li><a href="#notes">Notes</a>
</ul>
@@ -814,19 +812,6 @@ bool operator==(const iterator_adaptor&lt;B1,P,V1,R1,P1,C,D&gt;&amp;,
// and similarly for operators !=, &lt;, &lt;=, &gt;=, &gt;
</pre>
<h3><a name="portability">Portability</a></h3>
<p>Generally, the iterator adaptors library can be compiled with all compilers
supporting iterator traits and type traits.</p>
<p>Microsoft VC++ is not able to handle iterator adaptors based on a
<code>vector<T>::iterator</code> without specifying all template paramters explicitly.
In case not all template parameters are specified explicitly, the iterator adaptors
library will deduce these types using iterator_traits. But since in VC++ a
<code>vector<T>::iterator</code> is a <code>T*</code>, VC++ can't handle using
iterator_traits due to the lack of partial template specialization.</p>
<h3><a name="notes">Notes</a></h3>
<p><a name="1">[1]</a> The standard specifies that the <tt>value_type</tt>

View File

@@ -20,7 +20,7 @@
namespace
{
class DontTreadOnMe : private boost::noncopyable
class DontTreadOnMe : boost::noncopyable
{
public:
DontTreadOnMe() { std::cout << "defanged!" << std::endl; }

View File

@@ -499,6 +499,7 @@ namespace
void operator()(boost::minstd_rand& randomizer) const
{
Big b1 = Big( randomizer() );
Big b2 = Big( randomizer() );
Small s = Small( randomizer() );
test_left( Wrapped6<Big, Small>(b1), s, b1, s );