Trailing whitespaces

[SVN r78516]
This commit is contained in:
Ion Gaztañaga committed 2012-05-20 09:54:48 +00:00
1 parent b8d71929b8
commit 19b14d339a
55 files changed
+385 -385

No files matched your search

+5 -5
View File
@@ -1,13 +1,13 @@
# Boost Intrusive Library Test Jamfile
# (C) Copyright Ion Gaztanaga 2006.
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# Use, modification and distribution are subject to 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)
# Adapted from John Maddock's TR1 Jamfile.v2
# Copyright John Maddock 2005.
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# Use, modification and distribution are subject to 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)
# this rule enumerates through all the sources and invokes
@@ -26,7 +26,7 @@ rule test_all
: # requirements
<toolset>acc:<linkflags>-lrt
<toolset>acc-pa_risc:<linkflags>-lrt
<toolset>gcc-mingw:<linkflags>"-lole32 -loleaut32"
<toolset>gcc-mingw:<linkflags>"-lole32 -loleaut32"
<host-os>hpux,<toolset>gcc:<linkflags>"-Wl,+as,mpas"
] ;
}
+2 -2
View File
@@ -24,7 +24,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_insert_before<boost::intrusive::avl_multiset<T,
struct has_insert_before<boost::intrusive::avl_multiset<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -146,7 +146,7 @@ class test_main_template<VoidPointer, false>
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false>()();
test_main_template<boost::intrusive::smart_ptr<void>, false>()();
+2 -2
View File
@@ -23,7 +23,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_insert_before<boost::intrusive::avl_set<T,
struct has_insert_before<boost::intrusive::avl_set<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -147,7 +147,7 @@ class test_main_template<VoidPointer, false>
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false>()();
test_main_template<boost::intrusive::smart_ptr<void>, false>()();
+1 -1
View File
@@ -29,7 +29,7 @@ class delete_disposer
{
typedef typename std::iterator_traits<Pointer>::value_type value_type;
BOOST_INTRUSIVE_INVARIANT_ASSERT(( detail::is_same<T, value_type>::value ));
delete boost::intrusive::detail::to_raw_pointer(p);
delete boost::intrusive::detail::to_raw_pointer(p);
}
};
+3 -3
View File
@@ -56,16 +56,16 @@ struct external_traits
: values_(values), node_array_(NumElem)
{}
node_ptr to_node_ptr (value_type &value)
node_ptr to_node_ptr (value_type &value)
{ return (&node_array_[0]) + (&value - values_); }
const_node_ptr to_node_ptr (const value_type &value) const
const_node_ptr to_node_ptr (const value_type &value) const
{ return &node_array_[0] + (&value - values_); }
pointer to_value_ptr(node_ptr n)
{ return values_ + (n - &node_array_[0]); }
const_pointer to_value_ptr(const_node_ptr n) const
const_pointer to_value_ptr(const_node_ptr n) const
{ return values_ + (n - &node_array_[0]); }
pointer values_;
+3 -3
View File
@@ -42,7 +42,7 @@ struct has_insert_before
};
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
struct test_generic_assoc
struct test_generic_assoc
{
typedef typename ValueTraits::value_type value_type;
static void test_all(std::vector<value_type>& values);
@@ -134,7 +134,7 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_erase_burst(
typedef typename std::vector<value_type>::const_iterator cvec_iterator;
//Random erasure
std::vector<cvec_iterator> it_vector;
for(cvec_iterator it(values.begin()), itend(values.end())
; it != itend
; ++it){
@@ -396,7 +396,7 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_before
{
assoc_type testset;
typedef typename std::vector<value_type>::iterator vec_iterator;
for(vec_iterator it(--values.end()); true; --it){
testset.push_front(*it);
if(it == values.begin()){
+9 -9
View File
@@ -42,7 +42,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_all ()
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
std::vector<value_type> values (6);
for (int i = 0; i < 6; ++i)
values[i].value_ = random_init[i];
values[i].value_ = random_init[i];
typedef typename ContainerDefiner
< value_type
@@ -77,7 +77,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_impl()
typedef typename ValueTraits::value_type value_type;
std::vector<value_type> values (5);
for (int i = 0; i < 5; ++i)
values[i].value_ = i;
values[i].value_ = i;
typedef typename ValueTraits::value_type value_type;
typedef typename ContainerDefiner
< value_type
@@ -92,7 +92,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_impl()
testset.erase (testset.iterator_to (values[0]));
testset.erase (testset.iterator_to (values[1]));
testset.insert (values[1]);
testset.erase (testset.iterator_to (values[2]));
testset.erase (testset.iterator_to (values[3]));
}
@@ -127,8 +127,8 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_sort(std::vector
BOOST_TEST (testset2.begin()->value_ == 2);
BOOST_TEST (testset2.rbegin()->value_ == 5);
}
}
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
void test_generic_multiset<ValueTraits, ContainerDefiner>::test_insert(std::vector<typename ValueTraits::value_type>& values)
@@ -165,7 +165,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_insert(std::vect
{ int init_values [] = { 1, 3, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset.begin() ); }
}
}
//test: insert (seq-version), swap, erase (seq-version), size:
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
@@ -191,7 +191,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_swap(std::vector
testset1.erase (testset1.iterator_to(values[5]), testset1.end());
BOOST_TEST (testset1.size() == 1);
BOOST_TEST (&*testset1.begin() == &values[3]);
}
}
//test: find, equal_range (lower_bound, upper_bound):
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
@@ -213,14 +213,14 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(std::vector
BOOST_TEST (i->value_ == 2);
BOOST_TEST ((++i)->value_ == 2);
std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3);
BOOST_TEST (std::distance (range.first, range.second) == 2);
cmp_val.value_ = 7;
BOOST_TEST (testset.find (cmp_val) == testset.end());
}
}
}}} //namespace boost::intrusive::test
+9 -9
View File
@@ -30,7 +30,7 @@ struct is_treap
};
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
struct test_generic_set
struct test_generic_set
{
typedef typename ValueTraits::value_type value_type;
static void test_all();
@@ -52,7 +52,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_all()
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
std::vector<value_type> values (6);
for (int i = 0; i < 6; ++i)
values[i].value_ = random_init[i];
values[i].value_ = random_init[i];
typedef typename ContainerDefiner
< value_type
@@ -88,7 +88,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_impl()
typedef typename ValueTraits::value_type value_type;
std::vector<value_type> values (5);
for (int i = 0; i < 5; ++i)
values[i].value_ = i;
values[i].value_ = i;
typedef typename ValueTraits::value_type value_type;
typedef typename ContainerDefiner
@@ -103,7 +103,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_impl()
testset.erase (testset.iterator_to (values[0]));
testset.erase (testset.iterator_to (values[1]));
testset.insert (values[1]);
testset.erase (testset.iterator_to (values[2]));
testset.erase (testset.iterator_to (values[3]));
}
@@ -137,8 +137,8 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_sort(std::vector<type
TEST_INTRUSIVE_SEQUENCE( init_values, testset2.rbegin() ); }
BOOST_TEST (testset2.begin()->value_ == 2);
BOOST_TEST (testset2.rbegin()->value_ == 5);
}
}
//test: insert, const_iterator, const_reverse_iterator, erase, s_iterator_to:
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
void test_generic_set<ValueTraits, ContainerDefiner>::test_insert(std::vector<typename ValueTraits::value_type>& values)
@@ -263,7 +263,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_swap(std::vector<type
BOOST_TEST (testset1.size() == 1);
// BOOST_TEST (&testset1.front() == &values[3]);
BOOST_TEST (&*testset1.begin() == &values[3]);
}
}
//test: find, equal_range (lower_bound, upper_bound):
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
@@ -284,14 +284,14 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(std::vector<type
BOOST_TEST (i->value_ == 2);
BOOST_TEST ((++i)->value_ != 2);
std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3);
BOOST_TEST (std::distance (range.first, range.second) == 1);
cmp_val.value_ = 7;
BOOST_TEST (testset.find (cmp_val) == testset.end());
}
}
}}} //namespace boost::intrusive::test
+9 -9
View File
@@ -31,14 +31,14 @@ struct private_type
private_type const &operator,(int) const;
};
typedef char yes_type;
typedef char yes_type;
struct no_type{ char dummy[2]; };
template<typename T>
no_type is_private_type(T const &);
yes_type is_private_type(private_type const &);
}}}}
}}}}
namespace boost{
@@ -121,9 +121,9 @@ class has_member_function_named_func
template<class U>
static zeroarg_checker_func<U> Test(zeroarg_checker_func<U>*);
template <class U>
template <class U>
static has_member_function_callable_with::no_type Test(...);
static const bool value
= sizeof(Test< Fun >(0)) == sizeof(has_member_function_callable_with::yes_type);
};
@@ -186,7 +186,7 @@ class has_member_function_named_func
);
};
}}}
}}}
namespace boost{
namespace intrusive{
@@ -216,7 +216,7 @@ class has_member_function_named_func
)
);
};
}}}
}}}
namespace boost{
namespace intrusive{
@@ -306,9 +306,9 @@ class has_member_function_named_func
template<class U>
static zeroarg_checker_func<U> Test(zeroarg_checker_func<U>*);
template <class U>
template <class U>
static has_member_function_callable_with::no_type Test(...);
static const bool value = sizeof(Test< Fun >(0))
== sizeof(has_member_function_callable_with::yes_type);
};
@@ -460,7 +460,7 @@ int main()
(void)check5;
(void)check6;
(void)check7;
}
}
return 0;
+2 -2
View File
@@ -141,7 +141,7 @@ struct even_odd
return v1.value_ < v2.value_;
else
return v2.value_ & 1;
}
}
};
struct is_even
@@ -149,7 +149,7 @@ struct is_even
template<class Hooks, bool constant_time_size>
bool operator()
(const testvalue<Hooks, constant_time_size>& v1) const
{ return (v1.value_ & 1) == 0; }
{ return (v1.value_ & 1) == 0; }
};
/*
struct int_testvalue_comp
+8 -8
View File
@@ -37,7 +37,7 @@ struct hooks
};
template<class ValueTraits>
struct test_list
struct test_list
{
typedef typename ValueTraits::value_type value_type;
static void test_all(std::vector<value_type>& values);
@@ -114,7 +114,7 @@ void test_list<ValueTraits>
testlist.pop_front();
BOOST_TEST (testlist.empty());
}
}
//test: constructor, iterator, reverse_iterator, sort, reverse:
@@ -196,7 +196,7 @@ void test_list<ValueTraits>
int init_values [] = { 1, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() );
}
//test: assign, insert, const_iterator, const_reverse_iterator, erase, s_iterator_to:
template<class ValueTraits>
void test_list<ValueTraits>
@@ -281,7 +281,7 @@ void test_list<ValueTraits>
testlist.clear();
}
}
}
}
//test: insert (seq-version), swap, splice, erase (seq-version):
template<class ValueTraits>
@@ -319,7 +319,7 @@ void test_list<ValueTraits>
{ int init_values [] = { 1, 3, 5, 2 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist2.begin() ); }
testlist1.splice (testlist1.end(), testlist2,
testlist1.splice (testlist1.end(), testlist2,
testlist2.begin(), ----testlist2.end());
{ int init_values [] = { 4, 1, 3 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
@@ -414,7 +414,7 @@ class test_main_template
typedef testvalue<hooks<VoidPointer>, constant_time_size> value_type;
std::vector<value_type> data (5);
for (int i = 0; i < 5; ++i)
data[i].value_ = i + 1;
data[i].value_ = i + 1;
test_list < typename detail::get_base_value_traits
< value_type
@@ -442,7 +442,7 @@ class test_main_template<VoidPointer, false>
typedef testvalue<hooks<VoidPointer>, false> value_type;
std::vector<value_type> data (5);
for (int i = 0; i < 5; ++i)
data[i].value_ = i + 1;
data[i].value_ = i + 1;
test_list < typename detail::get_base_value_traits
< value_type
@@ -489,7 +489,7 @@ class test_main_template<VoidPointer, false>
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false>()();
test_main_template<smart_ptr<void>, false>()();
+2 -2
View File
@@ -23,7 +23,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_insert_before<boost::intrusive::multiset<T,
struct has_insert_before<boost::intrusive::multiset<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -145,7 +145,7 @@ class test_main_template<VoidPointer, false>
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false>()();
test_main_template<boost::intrusive::smart_ptr<void>, false>()();
+1 -1
View File
@@ -49,7 +49,7 @@ void instantiate()
list< Foo, base_hook<ListBaseHook> > list_; list_.clear();
slist< Foo, base_hook<SListBaseHook> > slist_; slist_.clear();
set< Foo, base_hook<SetBaseHook> > set_; set_.clear();
USet::bucket_type buckets[1];
USet unordered_set_(USet::bucket_traits(buckets, 1)); unordered_set_.clear();
}
+2 -2
View File
@@ -24,7 +24,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_insert_before<boost::intrusive::set<T,
struct has_insert_before<boost::intrusive::set<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -148,7 +148,7 @@ class test_main_template<VoidPointer, false>
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false>()();
test_main_template<boost::intrusive::smart_ptr<void>, false>()();
+2 -2
View File
@@ -40,7 +40,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_insert_before<boost::intrusive::sg_multiset<T,
struct has_insert_before<boost::intrusive::sg_multiset<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -143,7 +143,7 @@ class test_main_template
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*>()();
test_main_template<boost::intrusive::smart_ptr<void> >()();
+3 -3
View File
@@ -22,7 +22,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_rebalance<boost::intrusive::sg_set<T,
struct has_rebalance<boost::intrusive::sg_set<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -38,7 +38,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_insert_before<boost::intrusive::sg_set<T,
struct has_insert_before<boost::intrusive::sg_set<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -142,7 +142,7 @@ class test_main_template
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*>()();
test_main_template<boost::intrusive::smart_ptr<void> >()();
+12 -12
View File
@@ -38,7 +38,7 @@ struct hooks
};
template<class ValueTraits, bool Linear, bool CacheLast>
struct test_slist
struct test_slist
{
typedef typename ValueTraits::value_type value_type;
static void test_all(std::vector<value_type>& values);
@@ -106,7 +106,7 @@ void test_slist<ValueTraits, Linear, CacheLast>
> list_type;
list_type testlist;
BOOST_TEST (testlist.empty());
testlist.push_front (values[0]);
BOOST_TEST (testlist.size() == 1);
BOOST_TEST (&testlist.front() == &values[0]);
@@ -114,11 +114,11 @@ void test_slist<ValueTraits, Linear, CacheLast>
testlist.push_front (values[1]);
BOOST_TEST (testlist.size() == 2);
BOOST_TEST (&testlist.front() == &values[1]);
testlist.pop_front();
BOOST_TEST (testlist.size() == 1);
BOOST_TEST (&testlist.front() == &values[0]);
testlist.pop_front();
BOOST_TEST (testlist.empty());
}
@@ -241,8 +241,8 @@ void test_slist<ValueTraits, Linear, CacheLast>
testlist.reverse();
{ int init_values [] = { 5, 3, 1, 4, 2 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist.begin() ); }
}
}
//test: assign, insert_after, const_iterator, erase_after, s_iterator_to, previous:
template<class ValueTraits, bool Linear, bool CacheLast>
void test_slist<ValueTraits, Linear, CacheLast>
@@ -374,7 +374,7 @@ void test_slist<ValueTraits, Linear, CacheLast>
testlist.clear();
}
}
}
}
//test: insert_after (seq-version), swap, splice_after:
template<class ValueTraits, bool Linear, bool CacheLast>
@@ -410,7 +410,7 @@ void test_slist<ValueTraits, Linear, CacheLast>
{ int init_values [] = { 1, 3, 5, 2 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist2.begin() ); }
testlist1.splice_after (testlist1.begin(), testlist2,
testlist1.splice_after (testlist1.begin(), testlist2,
testlist2.before_begin(), ++++testlist2.begin());
{ int init_values [] = { 4, 1, 3, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
@@ -476,7 +476,7 @@ void test_slist<ValueTraits, Linear, CacheLast>
{ int init_values [] = { 1 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
}
}
}
template<class ValueTraits, bool Linear, bool CacheLast>
void test_slist<ValueTraits, Linear, CacheLast>
@@ -529,7 +529,7 @@ class test_main_template
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
std::vector<value_type> data (5);
for (int i = 0; i < 5; ++i)
data[i].value_ = i + 1;
data[i].value_ = i + 1;
test_slist < typename detail::get_base_value_traits
< value_type
@@ -620,7 +620,7 @@ class test_main_template<VoidPointer, false>
typedef testvalue<hooks<VoidPointer> , false> value_type;
std::vector<value_type> data (5);
for (int i = 0; i < 5; ++i)
data[i].value_ = i + 1;
data[i].value_ = i + 1;
test_slist < typename detail::get_base_value_traits
< value_type
@@ -721,7 +721,7 @@ class test_main_template<VoidPointer, false>
}
};
int main(int, char* [])
int main(int, char* [])
{
test_main_template<void*, false>()();
test_main_template<smart_ptr<void>, false>()();
+49 -49
View File
@@ -37,8 +37,8 @@ struct empty_type{};
template<class T>
struct random_it
: public boost::iterator<std::random_access_iterator_tag,
T, std::ptrdiff_t, T*, T&>
: public boost::iterator<std::random_access_iterator_tag,
T, std::ptrdiff_t, T*, T&>
{
typedef const T* const_pointer;
typedef const T& const_reference;
@@ -121,11 +121,11 @@ class smart_ptr
//!Constructor from other pointer. Never throws.
template <class T>
smart_ptr(T *ptr)
smart_ptr(T *ptr)
: m_ptr(ptr)
{}
*/
//!Constructor from other smart_ptr
//!Constructor from other smart_ptr
smart_ptr(const smart_ptr& ptr)
: m_ptr(ptr.m_ptr)
{}
@@ -133,10 +133,10 @@ class smart_ptr
static smart_ptr pointer_to(reference r)
{ smart_ptr p; p.m_ptr = &r; return p; }
//!Constructor from other smart_ptr. If pointers of pointee types are
//!Constructor from other smart_ptr. If pointers of pointee types are
//!convertible, offset_ptrs will be convertibles. Never throws.
template<class T2>
smart_ptr(const smart_ptr<T2> &ptr)
smart_ptr(const smart_ptr<T2> &ptr)
: m_ptr(ptr.m_ptr)
{}
/*
@@ -169,16 +169,16 @@ class smart_ptr
{ return m_ptr; }
*/
//!Pointer-like -> operator. It can return 0 pointer. Never throws.
pointer operator->() const
pointer operator->() const
{ return m_ptr; }
//!Dereferencing operator, if it is a null smart_ptr behavior
//!Dereferencing operator, if it is a null smart_ptr behavior
//! is undefined. Never throws.
reference operator* () const
reference operator* () const
{ return *m_ptr; }
//!Indexing operator. Never throws.
reference operator[](std::ptrdiff_t idx) const
reference operator[](std::ptrdiff_t idx) const
{ return m_ptr[idx]; }
/*
//!Assignment from pointer (saves extra conversion). Never throws.
@@ -189,14 +189,14 @@ class smart_ptr
smart_ptr& operator= (const smart_ptr & pt)
{ m_ptr = pt.m_ptr; return *this; }
//!Assignment from related smart_ptr. If pointers of pointee types
//!Assignment from related smart_ptr. If pointers of pointee types
//! are assignable, offset_ptrs will be assignable. Never throws.
template <class T2>
smart_ptr& operator= (const smart_ptr<T2> & pt)
{ m_ptr = pt.m_ptr; return *this; }
//!smart_ptr + std::ptrdiff_t. Never throws.
smart_ptr operator+ (std::ptrdiff_t offset) const
smart_ptr operator+ (std::ptrdiff_t offset) const
{ smart_ptr s; s.m_ptr = m_ptr + offset; return s; }
//!smart_ptr - std::ptrdiff_t. Never throws.
@@ -212,7 +212,7 @@ class smart_ptr
{ m_ptr -= offset; return *this; }
//!++smart_ptr. Never throws.
smart_ptr& operator++ (void)
smart_ptr& operator++ (void)
{ ++m_ptr; return *this; }
//!smart_ptr++. Never throws.
@@ -220,7 +220,7 @@ class smart_ptr
{ smart_ptr temp(*this); ++*this; return temp; }
//!--smart_ptr. Never throws.
smart_ptr& operator-- (void)
smart_ptr& operator-- (void)
{ --m_ptr; return *this; }
//!smart_ptr--. Never throws.
@@ -228,16 +228,16 @@ class smart_ptr
{ smart_ptr temp(*this); --*this; return temp; }
//!safe bool conversion operator. Never throws.
operator unspecified_bool_type() const
operator unspecified_bool_type() const
{ return m_ptr? &self_t::unspecified_bool_type_func : 0; }
//!Not operator. Not needed in theory, but improves portability.
//!Not operator. Not needed in theory, but improves portability.
//!Never throws.
bool operator! () const
{ return m_ptr == 0; }
/*
friend void swap (smart_ptr &pt, smart_ptr &pt2)
{
{
value_type *ptr = pt.get();
pt = pt2;
pt2 = ptr;
@@ -247,102 +247,102 @@ class smart_ptr
//!smart_ptr<T1> == smart_ptr<T2>. Never throws.
template<class T1, class T2>
inline bool operator== (const smart_ptr<T1> &pt1,
inline bool operator== (const smart_ptr<T1> &pt1,
const smart_ptr<T2> &pt2)
{ return pt1.operator->() == pt2.operator->(); }
//!smart_ptr<T1> != smart_ptr<T2>. Never throws.
template<class T1, class T2>
inline bool operator!= (const smart_ptr<T1> &pt1,
inline bool operator!= (const smart_ptr<T1> &pt1,
const smart_ptr<T2> &pt2)
{ return pt1.operator->() != pt2.operator->(); }
//!smart_ptr<T1> < smart_ptr<T2>. Never throws.
template<class T1, class T2>
inline bool operator< (const smart_ptr<T1> &pt1,
inline bool operator< (const smart_ptr<T1> &pt1,
const smart_ptr<T2> &pt2)
{ return pt1.operator->() < pt2.operator->(); }
//!smart_ptr<T1> <= smart_ptr<T2>. Never throws.
template<class T1, class T2>
inline bool operator<= (const smart_ptr<T1> &pt1,
inline bool operator<= (const smart_ptr<T1> &pt1,
const smart_ptr<T2> &pt2)
{ return pt1.operator->() <= pt2.operator->(); }
//!smart_ptr<T1> > smart_ptr<T2>. Never throws.
template<class T1, class T2>
inline bool operator> (const smart_ptr<T1> &pt1,
inline bool operator> (const smart_ptr<T1> &pt1,
const smart_ptr<T2> &pt2)
{ return pt1.operator->() > pt2.operator->(); }
//!smart_ptr<T1> >= smart_ptr<T2>. Never throws.
template<class T1, class T2>
inline bool operator>= (const smart_ptr<T1> &pt1,
inline bool operator>= (const smart_ptr<T1> &pt1,
const smart_ptr<T2> &pt2)
{ return pt1.operator->() >= pt2.operator->(); }
//!operator<<
template<class E, class T, class Y>
inline std::basic_ostream<E, T> & operator<<
//!operator<<
template<class E, class T, class Y>
inline std::basic_ostream<E, T> & operator<<
(std::basic_ostream<E, T> & os, smart_ptr<Y> const & p)
{ return os << p.operator->(); }
//!operator>>
template<class E, class T, class Y>
inline std::basic_istream<E, T> & operator>>
//!operator>>
template<class E, class T, class Y>
inline std::basic_istream<E, T> & operator>>
(std::basic_istream<E, T> & os, smart_ptr<Y> & p)
{ Y * tmp; return os >> tmp; p = tmp; }
//!std::ptrdiff_t + smart_ptr
//!std::ptrdiff_t + smart_ptr
template<class T>
inline smart_ptr<T> operator+(std::ptrdiff_t diff, const smart_ptr<T>& right)
{ return right + diff; }
//!smart_ptr - smart_ptr
//!smart_ptr - smart_ptr
template<class T, class T2>
inline std::ptrdiff_t operator- (const smart_ptr<T> &pt, const smart_ptr<T2> &pt2)
{ return pt.operator->()- pt2.operator->(); }
//!swap specialization
//!swap specialization
template<class T>
inline void swap (smart_ptr<T> &pt,
inline void swap (smart_ptr<T> &pt,
smart_ptr<T> &pt2)
{
{
typename smart_ptr<T>::value_type *ptr = pt.operator->();
pt = pt2;
pt2 = ptr;
}
//!Simulation of static_cast between pointers. Never throws.
template<class T, class U>
inline smart_ptr<T>
template<class T, class U>
inline smart_ptr<T>
static_pointer_cast(const smart_ptr<U> & r)
{
return smart_ptr<T>(r, detail::static_cast_tag());
{
return smart_ptr<T>(r, detail::static_cast_tag());
}
//!Simulation of const_cast between pointers. Never throws.
template<class T, class U>
template<class T, class U>
inline smart_ptr<T>const_pointer_cast(smart_ptr<U> const & r)
{
return smart_ptr<T>(r, detail::const_cast_tag());
{
return smart_ptr<T>(r, detail::const_cast_tag());
}
//!Simulation of dynamic_cast between pointers. Never throws.
template<class T, class U>
inline smart_ptr<T>
template<class T, class U>
inline smart_ptr<T>
dynamic_pointer_cast(smart_ptr<U> const & r)
{
{
return smart_ptr<T>
(r, detail::dynamic_cast_tag());
(r, detail::dynamic_cast_tag());
}
//!Simulation of reinterpret_cast between pointers. Never throws.
template<class T, class U>
template<class T, class U>
inline smart_ptr<T>
reinterpret_pointer_cast(smart_ptr<U> const & r)
{
return smart_ptr<T>(r, detail::reinterpret_cast_tag());
{
return smart_ptr<T>(r, detail::reinterpret_cast_tag());
}
} //namespace intrusive {
+3 -3
View File
@@ -41,7 +41,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_splay<boost::intrusive::splay_multiset<T,
struct has_splay<boost::intrusive::splay_multiset<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -57,7 +57,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_rebalance<boost::intrusive::splay_multiset<T,
struct has_rebalance<boost::intrusive::splay_multiset<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -177,7 +177,7 @@ class test_main_template<VoidPointer, false>
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false>()();
test_main_template<boost::intrusive::smart_ptr<void>, false>()();
+1 -1
View File
@@ -175,7 +175,7 @@ class test_main_template<VoidPointer, false>
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false>()();
test_main_template<boost::intrusive::smart_ptr<void>, false>()();
+3 -3
View File
@@ -57,16 +57,16 @@ struct stateful_value_traits
: values_(values), node_array_(node_array)
{}
node_ptr to_node_ptr (value_type &value)
node_ptr to_node_ptr (value_type &value)
{ return node_array_ + (&value - values_); }
const_node_ptr to_node_ptr (const value_type &value) const
const_node_ptr to_node_ptr (const value_type &value) const
{ return node_array_ + (&value - values_); }
pointer to_value_ptr(node_ptr n)
{ return values_ + (n - node_array_); }
const_pointer to_value_ptr(const_node_ptr n) const
const_pointer to_value_ptr(const_node_ptr n) const
{ return values_ + (n - node_array_); }
pointer values_;
+1 -1
View File
@@ -247,7 +247,7 @@ void test_common_unordered_and_associative_container(Container & c, Data & d)
{
BOOST_TEST( c.find(*di) != c.end() );
}
typename Data::const_iterator db = d.begin();
typename Data::const_iterator da = db++;
+2 -2
View File
@@ -24,7 +24,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_insert_before<boost::intrusive::treap_multiset<T,
struct has_insert_before<boost::intrusive::treap_multiset<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -143,7 +143,7 @@ class test_main_template<VoidPointer, false>
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false>()();
test_main_template<boost::intrusive::smart_ptr<void>, false>()();
+3 -3
View File
@@ -22,7 +22,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct has_insert_before<boost::intrusive::treap_set<T,
struct has_insert_before<boost::intrusive::treap_set<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -38,7 +38,7 @@ template<class T, class O1, class O2, class O3, class O4>
#else
template<class T, class ...Options>
#endif
struct is_treap<boost::intrusive::treap_set<T,
struct is_treap<boost::intrusive::treap_set<T,
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -159,7 +159,7 @@ class test_main_template<VoidPointer, false>
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false>()();
test_main_template<boost::intrusive::smart_ptr<void>, false>()();
+13 -13
View File
@@ -144,7 +144,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
std::vector<value_type> values (5);
for (int i = 0; i < 5; ++i)
values[i].value_ = i;
values[i].value_ = i;
typename unordered_multiset_type::bucket_type buckets [BucketSize];
unordered_multiset_type testset(bucket_traits(
@@ -157,7 +157,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
testset.erase (testset.iterator_to (values[0]));
testset.erase (testset.iterator_to (values[1]));
testset.insert (values[1]);
testset.erase (testset.iterator_to (values[2]));
testset.erase (testset.iterator_to (values[3]));
}
@@ -194,7 +194,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
}
testset1.clear();
BOOST_TEST (testset1.empty());
}
}
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
@@ -231,7 +231,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
i = testset.insert (values[0]);
BOOST_TEST (&*i == &values[0]);
i = testset.iterator_to (values[2]);
BOOST_TEST (&*i == &values[2]);
testset.erase(i);
@@ -275,7 +275,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
i = testset.insert (values[0]);
BOOST_TEST (&*i == &values[0]);
i = testset.iterator_to (values[2]);
BOOST_TEST (&*i == &values[2]);
testset.erase(i);
@@ -317,7 +317,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
for(unsigned int i = 0, max = random_size; i != max; ++i){
std::vector<typename ValueTraits::value_type> data (random_size);
for (unsigned int j = 0; j < random_size; ++j)
data[j].value_ = random_init[j];
data[j].value_ = random_init[j];
unordered_multiset_type testset_new(bucket_traits(
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
pointer_to(single_bucket[0]), 1));
@@ -442,7 +442,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>:
// BOOST_TEST (&testset1.front() == &values[3]);
BOOST_TEST (&*testset1.begin() == &values[3]);
}
}
}
@@ -651,7 +651,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
BOOST_TEST (testset1.size() == values.size());
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
}
}
//test: find, equal_range (lower_bound, upper_bound):
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
@@ -682,14 +682,14 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>:
BOOST_TEST (i->value_ == 2);
BOOST_TEST ((++i)->value_ == 2);
std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3);
BOOST_TEST (std::distance (range.first, range.second) == 2);
cmp_val.value_ = 7;
BOOST_TEST (testset.find (cmp_val) == testset.end());
}
}
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
@@ -781,7 +781,7 @@ class test_main_template
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
std::vector<testvalue<hooks<VoidPointer> , constant_time_size> > data (6);
for (int i = 0; i < 6; ++i)
data[i].value_ = random_init[i];
data[i].value_ = random_init[i];
test_unordered_multiset < typename detail::get_base_value_traits
< value_type
@@ -817,7 +817,7 @@ class test_main_template<VoidPointer, false, Incremental>
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
std::vector<testvalue<hooks<VoidPointer> , false> > data (6);
for (int i = 0; i < 6; ++i)
data[i].value_ = random_init[i];
data[i].value_ = random_init[i];
test_unordered_multiset < typename detail::get_base_value_traits
< value_type
@@ -864,7 +864,7 @@ class test_main_template<VoidPointer, false, Incremental>
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false, true>()();
test_main_template<smart_ptr<void>, false, true>()();
+12 -12
View File
@@ -71,7 +71,7 @@ struct hooks
static const std::size_t BucketSize = 8;
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
struct test_unordered_set
struct test_unordered_set
{
typedef typename ValueTraits::value_type value_type;
static void test_all(std::vector<value_type>& values);
@@ -142,7 +142,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::test
std::vector<value_type> values (5);
for (int i = 0; i < 5; ++i)
values[i].value_ = i;
values[i].value_ = i;
typename unordered_set_type::bucket_type buckets [BucketSize];
unordered_set_type testset(bucket_traits(
@@ -188,11 +188,11 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
{ int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
}
testset1.clear();
BOOST_TEST (testset1.empty());
}
}
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
@@ -251,7 +251,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
{ int init_values [] = { 1, 3, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
}
}
}
//test: insert (seq-version), swap, erase (seq-version), size:
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
@@ -299,7 +299,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
BOOST_TEST (testset1.size() == 1);
BOOST_TEST (&*testset1.begin() == &values[3]);
}
}
}
//test: rehash:
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
@@ -507,7 +507,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
BOOST_TEST (testset1.size() == values.size()-1);
{ int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
}
}
//test: find, equal_range (lower_bound, upper_bound):
@@ -538,7 +538,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
BOOST_TEST (i->value_ == 2);
BOOST_TEST ((++i)->value_ != 2);
std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3);
BOOST_TEST (std::distance (range.first, range.second) == 1);
@@ -636,7 +636,7 @@ class test_main_template
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
std::vector<testvalue<hooks<VoidPointer> , constant_time_size> > data (6);
for (int i = 0; i < 6; ++i)
data[i].value_ = random_init[i];
data[i].value_ = random_init[i];
test_unordered_set < typename detail::get_base_value_traits
< value_type
@@ -672,7 +672,7 @@ class test_main_template<VoidPointer, false, incremental>
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
std::vector<testvalue<hooks<VoidPointer> , false> > data (6);
for (int i = 0; i < 6; ++i)
data[i].value_ = random_init[i];
data[i].value_ = random_init[i];
test_unordered_set < typename detail::get_base_value_traits
< value_type
@@ -719,7 +719,7 @@ class test_main_template<VoidPointer, false, incremental>
}
};
int main( int, char* [] )
int main( int, char* [] )
{
test_main_template<void*, false, true>()();
test_main_template<smart_ptr<void>, false, true>()();
+1 -1
View File
@@ -78,7 +78,7 @@ int main()
//Test the objects inserted in the base hook list
for(; vect_it != vect_itend; ++vect_it, ++list_it)
if(&*list_it != &*vect_it)
if(&*list_it != &*vect_it)
return 1;
}