forked from boostorg/intrusive
Trailing whitespaces
[SVN r78516]
This commit is contained in:
1 parent
b8d71929b8
commit
19b14d339a
55 files changed
+385
-385
No files matched your search
+6
-6
@@ -1,14 +1,14 @@
|
||||
# Boost Intrusive Library Example Jamfile
|
||||
|
||||
# (C) Copyright Ion Gaztanaga 2006-2007.
|
||||
# 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
|
||||
@@ -27,7 +27,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"
|
||||
] ;
|
||||
}
|
||||
@@ -35,4 +35,4 @@ rule test_all
|
||||
return $(all_rules) ;
|
||||
}
|
||||
|
||||
test-suite intrusive_example : [ test_all r ] : <threading>multi ;
|
||||
test-suite intrusive_example : [ test_all r ] : <threading>multi ;
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <vector>
|
||||
|
||||
//This is the node that will be used with algorithms.
|
||||
//This is the node that will be used with algorithms.
|
||||
struct simple_node
|
||||
{
|
||||
simple_node *prev_;
|
||||
@@ -26,7 +26,7 @@ struct simple_node
|
||||
class base_1{};
|
||||
class base_2{};
|
||||
|
||||
struct value_1 : public base_1, public simple_node
|
||||
struct value_1 : public base_1, public simple_node
|
||||
{ int id_; };
|
||||
|
||||
struct value_2 : public base_1, public base_2, public simple_node
|
||||
@@ -38,10 +38,10 @@ struct simple_node_traits
|
||||
typedef simple_node node;
|
||||
typedef node * node_ptr;
|
||||
typedef const node * const_node_ptr;
|
||||
static node *get_next(const node *n) { return n->next_; }
|
||||
static void set_next(node *n, node *next) { n->next_ = next; }
|
||||
static node *get_previous(const node *n) { return n->prev_; }
|
||||
static void set_previous(node *n, node *prev) { n->prev_ = prev; }
|
||||
static node *get_next(const node *n) { return n->next_; }
|
||||
static void set_next(node *n, node *next) { n->next_ = next; }
|
||||
static node *get_previous(const node *n) { return n->prev_; }
|
||||
static void set_previous(node *n, node *prev) { n->prev_ = prev; }
|
||||
};
|
||||
|
||||
//A templatized value traits for value_1 and value_2
|
||||
|
||||
@@ -26,17 +26,17 @@ struct simple_node_traits
|
||||
typedef simple_node node;
|
||||
typedef node * node_ptr;
|
||||
typedef const node * const_node_ptr;
|
||||
static node *get_next(const node *n) { return n->next_; }
|
||||
static void set_next(node *n, node *next) { n->next_ = next; }
|
||||
static node *get_previous(const node *n) { return n->prev_; }
|
||||
static void set_previous(node *n, node *prev) { n->prev_ = prev; }
|
||||
static node *get_next(const node *n) { return n->next_; }
|
||||
static void set_next(node *n, node *next) { n->next_ = next; }
|
||||
static node *get_previous(const node *n) { return n->prev_; }
|
||||
static void set_previous(node *n, node *prev) { n->prev_ = prev; }
|
||||
};
|
||||
|
||||
//[doc_advanced_value_traits2_value_traits
|
||||
class base_1{};
|
||||
class base_2{};
|
||||
|
||||
struct value_1 : public base_1, public simple_node
|
||||
struct value_1 : public base_1, public simple_node
|
||||
{
|
||||
int id_;
|
||||
simple_node node_;
|
||||
|
||||
@@ -20,7 +20,7 @@ using namespace boost::intrusive;
|
||||
struct StrHasher
|
||||
{
|
||||
std::size_t operator()(const char *str) const
|
||||
{
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
for(; *str; ++str) boost::hash_combine(seed, *str);
|
||||
return seed;
|
||||
@@ -31,7 +31,7 @@ class Expensive : public set_base_hook<>, public unordered_set_base_hook<>
|
||||
{
|
||||
std::string key_;
|
||||
// Other members...
|
||||
|
||||
|
||||
public:
|
||||
Expensive(const char *key)
|
||||
: key_(key)
|
||||
|
||||
@@ -55,10 +55,10 @@ int main()
|
||||
|
||||
BaseSet baseset;
|
||||
MemberMultiset membermultiset;
|
||||
|
||||
//Check that size optimization is activated in the base hook
|
||||
|
||||
//Check that size optimization is activated in the base hook
|
||||
assert(sizeof(avl_set_base_hook<optimize_size<true> >) == 3*sizeof(void*));
|
||||
//Check that size optimization is deactivated in the member hook
|
||||
//Check that size optimization is deactivated in the member hook
|
||||
assert(sizeof(avl_set_member_hook<>) > 3*sizeof(void*));
|
||||
|
||||
//Now insert them in the sets
|
||||
|
||||
@@ -32,13 +32,13 @@ struct my_avltree_node_traits
|
||||
typedef const my_node * const_node_ptr;
|
||||
typedef int balance;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
|
||||
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
|
||||
static node_ptr get_left(const_node_ptr n) { return n->left_; }
|
||||
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
|
||||
static node_ptr get_right(const_node_ptr n) { return n->right_; }
|
||||
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
|
||||
static balance get_balance(const_node_ptr n) { return n->balance_; }
|
||||
static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
|
||||
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
|
||||
static node_ptr get_left(const_node_ptr n) { return n->left_; }
|
||||
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
|
||||
static node_ptr get_right(const_node_ptr n) { return n->right_; }
|
||||
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
|
||||
static balance get_balance(const_node_ptr n) { return n->balance_; }
|
||||
static void set_balance(node_ptr n, balance b) { n->balance_ = b; }
|
||||
static balance negative() { return -1; }
|
||||
static balance zero() { return 0; }
|
||||
@@ -72,7 +72,7 @@ int main()
|
||||
|
||||
//Now go to the next node
|
||||
n = algo::next_node(n);
|
||||
assert(n == &three);
|
||||
assert(n == &three);
|
||||
|
||||
//Erase a node just using a pointer to it
|
||||
algo::unlink(&two);
|
||||
|
||||
@@ -38,14 +38,14 @@ entity::~entity()
|
||||
|
||||
//Function to insert a new "some_entity" in the global list
|
||||
void insert_some_entity()
|
||||
{ global_list.push_back (*new some_entity(/*...*/)); }
|
||||
{ global_list.push_back (*new some_entity(/*...*/)); }
|
||||
|
||||
//Function to clear an entity from the intrusive global list
|
||||
void clear_list ()
|
||||
{
|
||||
// entity's destructor removes itself from the global list implicitly
|
||||
while (!global_list.empty())
|
||||
delete &global_list.front();
|
||||
delete &global_list.front();
|
||||
}
|
||||
|
||||
int main()
|
||||
|
||||
@@ -33,8 +33,8 @@ class external_traits
|
||||
typedef node * node_ptr;
|
||||
typedef const node * const_node_ptr;
|
||||
typedef identifier_t value_type;
|
||||
typedef identifier_t * pointer;
|
||||
typedef const identifier_t * const_pointer;
|
||||
typedef identifier_t * pointer;
|
||||
typedef const identifier_t * const_pointer;
|
||||
static const link_mode_type link_mode = normal_link;
|
||||
|
||||
external_traits(pointer ids, std::size_t NumElements)
|
||||
@@ -63,7 +63,7 @@ class external_traits
|
||||
struct internal_traits
|
||||
{
|
||||
static const bool external_value_traits = true;
|
||||
typedef external_traits value_traits;
|
||||
typedef external_traits value_traits;
|
||||
|
||||
template<class Container>
|
||||
value_traits &get_value_traits(Container &cont);
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef list<MyClass> BaseList;
|
||||
|
||||
//Define a list that will store MyClass using the public member hook
|
||||
typedef list< MyClass
|
||||
, member_hook< MyClass, list_member_hook<>, &MyClass::member_hook_>
|
||||
, member_hook< MyClass, list_member_hook<>, &MyClass::member_hook_>
|
||||
> MemberList;
|
||||
|
||||
int main()
|
||||
|
||||
@@ -25,10 +25,10 @@ struct my_list_node_traits
|
||||
typedef my_node node;
|
||||
typedef my_node * node_ptr;
|
||||
typedef const my_node * const_node_ptr;
|
||||
static node_ptr get_next(const_node_ptr n) { return n->next_; }
|
||||
static void set_next(node_ptr n, node_ptr next) { n->next_ = next; }
|
||||
static node *get_previous(const_node_ptr n) { return n->prev_; }
|
||||
static void set_previous(node_ptr n, node_ptr prev){ n->prev_ = prev; }
|
||||
static node_ptr get_next(const_node_ptr n) { return n->next_; }
|
||||
static void set_next(node_ptr n, node_ptr next) { n->next_ = next; }
|
||||
static node *get_previous(const_node_ptr n) { return n->prev_; }
|
||||
static void set_previous(node_ptr n, node_ptr prev){ n->prev_ = prev; }
|
||||
};
|
||||
|
||||
int main()
|
||||
|
||||
@@ -61,7 +61,7 @@ int main()
|
||||
const int ShmSize = 50000;
|
||||
const char *ShmName = get_shared_memory_name();
|
||||
{
|
||||
//Erase all old shared memory
|
||||
//Erase all old shared memory
|
||||
ip::shared_memory_object::remove(ShmName);
|
||||
ip::managed_shared_memory shm(ip::create_only, ShmName, ShmSize);
|
||||
|
||||
@@ -72,7 +72,7 @@ int main()
|
||||
shm_allocator_t;
|
||||
typedef ip::vector<shared_memory_data, shm_allocator_t> shm_vector_t;
|
||||
shm_allocator_t shm_alloc(shm.get_segment_manager());
|
||||
shm_vector_t *pshm_vect =
|
||||
shm_vector_t *pshm_vect =
|
||||
shm.construct<shm_vector_t>(ip::anonymous_instance)(shm_alloc);
|
||||
pshm_vect->resize(MaxElem);
|
||||
|
||||
|
||||
@@ -31,13 +31,13 @@ struct my_rbtree_node_traits
|
||||
typedef my_node * node_ptr;
|
||||
typedef const my_node * const_node_ptr;
|
||||
typedef int color;
|
||||
static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
|
||||
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
|
||||
static node_ptr get_left(const_node_ptr n) { return n->left_; }
|
||||
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
|
||||
static node_ptr get_right(const_node_ptr n) { return n->right_; }
|
||||
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
|
||||
static color get_color(const_node_ptr n) { return n->color_; }
|
||||
static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
|
||||
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
|
||||
static node_ptr get_left(const_node_ptr n) { return n->left_; }
|
||||
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
|
||||
static node_ptr get_right(const_node_ptr n) { return n->right_; }
|
||||
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
|
||||
static color get_color(const_node_ptr n) { return n->color_; }
|
||||
static void set_color(node_ptr n, color c) { n->color_ = c; }
|
||||
static color black() { return color(0); }
|
||||
static color red() { return color(1); }
|
||||
@@ -70,7 +70,7 @@ int main()
|
||||
|
||||
//Now go to the next node
|
||||
n = algo::next_node(n);
|
||||
assert(n == &three);
|
||||
assert(n == &three);
|
||||
|
||||
//Erase a node just using a pointer to it
|
||||
algo::unlink(&two);
|
||||
|
||||
+3
-3
@@ -55,10 +55,10 @@ int main()
|
||||
|
||||
BaseSet baseset;
|
||||
MemberMultiset membermultiset;
|
||||
|
||||
//Check that size optimization is activated in the base hook
|
||||
|
||||
//Check that size optimization is activated in the base hook
|
||||
assert(sizeof(set_base_hook<optimize_size<true> >) == 3*sizeof(void*));
|
||||
//Check that size optimization is deactivated in the member hook
|
||||
//Check that size optimization is deactivated in the member hook
|
||||
assert(sizeof(set_member_hook<>) > 3*sizeof(void*));
|
||||
|
||||
//Now insert them in the reverse order in the base hook set
|
||||
|
||||
@@ -56,7 +56,7 @@ int main()
|
||||
|
||||
BaseSet baseset;
|
||||
MemberMultiset membermultiset;
|
||||
|
||||
|
||||
//Now insert them in the reverse order in the base hook sg_set
|
||||
for(VectIt it(values.begin()), itend(values.end()); it != itend; ++it){
|
||||
baseset.insert(*it);
|
||||
|
||||
@@ -25,8 +25,8 @@ struct my_slist_node_traits
|
||||
typedef my_node node;
|
||||
typedef my_node * node_ptr;
|
||||
typedef const my_node * const_node_ptr;
|
||||
static node_ptr get_next(const_node_ptr n) { return n->next_; }
|
||||
static void set_next(node_ptr n, node_ptr next) { n->next_ = next; }
|
||||
static node_ptr get_next(const_node_ptr n) { return n->next_; }
|
||||
static void set_next(node_ptr n, node_ptr next) { n->next_ = next; }
|
||||
};
|
||||
|
||||
int main()
|
||||
|
||||
@@ -31,12 +31,12 @@ struct my_splaytree_node_traits
|
||||
typedef my_node * node_ptr;
|
||||
typedef const my_node * const_node_ptr;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
|
||||
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
|
||||
static node_ptr get_left(const_node_ptr n) { return n->left_; }
|
||||
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
|
||||
static node_ptr get_right(const_node_ptr n) { return n->right_; }
|
||||
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
|
||||
static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
|
||||
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
|
||||
static node_ptr get_left(const_node_ptr n) { return n->left_; }
|
||||
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
|
||||
static node_ptr get_right(const_node_ptr n) { return n->right_; }
|
||||
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
|
||||
};
|
||||
|
||||
struct node_ptr_compare
|
||||
@@ -66,7 +66,7 @@ int main()
|
||||
|
||||
//Now go to the next node
|
||||
n = algo::next_node(n);
|
||||
assert(n == &three);
|
||||
assert(n == &three);
|
||||
|
||||
//Erase a node just using a pointer to it
|
||||
algo::unlink(&two);
|
||||
|
||||
@@ -20,7 +20,7 @@ using namespace boost::intrusive;
|
||||
class MyClass
|
||||
: public splay_set_base_hook<> //This is an splay tree base hook
|
||||
, public bs_set_base_hook<> //This is a binary search tree base hook
|
||||
|
||||
|
||||
{
|
||||
int int_;
|
||||
|
||||
|
||||
@@ -30,12 +30,12 @@ struct my_splaytree_node_traits
|
||||
typedef my_node * node_ptr;
|
||||
typedef const my_node * const_node_ptr;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
|
||||
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
|
||||
static node_ptr get_left(const_node_ptr n) { return n->left_; }
|
||||
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
|
||||
static node_ptr get_right(const_node_ptr n) { return n->right_; }
|
||||
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
|
||||
static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
|
||||
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
|
||||
static node_ptr get_left(const_node_ptr n) { return n->left_; }
|
||||
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
|
||||
static node_ptr get_right(const_node_ptr n) { return n->right_; }
|
||||
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
|
||||
};
|
||||
|
||||
struct node_ptr_compare
|
||||
@@ -65,7 +65,7 @@ int main()
|
||||
|
||||
//Now go to the next node
|
||||
n = algo::next_node(n);
|
||||
assert(n == &three);
|
||||
assert(n == &three);
|
||||
|
||||
//Erase a node just using a pointer to it
|
||||
algo::unlink(&two);
|
||||
|
||||
@@ -27,8 +27,8 @@ struct stateful_value_traits
|
||||
typedef node * node_ptr;
|
||||
typedef const node * const_node_ptr;
|
||||
typedef identifier_t value_type;
|
||||
typedef identifier_t * pointer;
|
||||
typedef const identifier_t * const_pointer;
|
||||
typedef identifier_t * pointer;
|
||||
typedef const identifier_t * const_pointer;
|
||||
static const link_mode_type link_mode = normal_link;
|
||||
|
||||
stateful_value_traits(pointer ids, node_ptr node_array)
|
||||
|
||||
@@ -31,12 +31,12 @@ struct my_treap_node_traits
|
||||
typedef my_node * node_ptr;
|
||||
typedef const my_node * const_node_ptr;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
|
||||
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
|
||||
static node_ptr get_left(const_node_ptr n) { return n->left_; }
|
||||
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
|
||||
static node_ptr get_right(const_node_ptr n) { return n->right_; }
|
||||
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
|
||||
static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
|
||||
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
|
||||
static node_ptr get_left(const_node_ptr n) { return n->left_; }
|
||||
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
|
||||
static node_ptr get_right(const_node_ptr n) { return n->right_; }
|
||||
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
|
||||
};
|
||||
|
||||
struct node_ptr_compare
|
||||
@@ -66,7 +66,7 @@ int main()
|
||||
|
||||
//Now go to the next node
|
||||
n = algo::next_node(n);
|
||||
assert(n == &three);
|
||||
assert(n == &three);
|
||||
|
||||
//Erase a node just using a pointer to it
|
||||
algo::unlink(&two, node_ptr_priority());
|
||||
|
||||
@@ -70,7 +70,7 @@ int main()
|
||||
|
||||
BaseSet baseset;
|
||||
MemberMultiset membermultiset;
|
||||
|
||||
|
||||
//Now insert them in the sets
|
||||
for(VectIt it(values.begin()), itend(values.end()); it != itend; ++it){
|
||||
baseset.insert(*it);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
//This node is the legacy type we can't modify and we want to insert in
|
||||
//intrusive list and slist containers using only two pointers, since
|
||||
//we know the object will never be at the same time in both lists.
|
||||
//we know the object will never be at the same time in both lists.
|
||||
struct legacy_value
|
||||
{
|
||||
legacy_value *prev_;
|
||||
@@ -39,14 +39,14 @@ struct legacy_node_traits
|
||||
typedef legacy_value * node_ptr;
|
||||
typedef const legacy_value * const_node_ptr;
|
||||
|
||||
static node *get_next(const node *n) { return n->next_; }
|
||||
static void set_next(node *n, node *next) { n->next_ = next; }
|
||||
static node *get_previous(const node *n) { return n->prev_; }
|
||||
static void set_previous(node *n, node *prev) { n->prev_ = prev; }
|
||||
static node *get_next(const node *n) { return n->next_; }
|
||||
static void set_next(node *n, node *next) { n->next_ = next; }
|
||||
static node *get_previous(const node *n) { return n->prev_; }
|
||||
static void set_previous(node *n, node *prev) { n->prev_ = prev; }
|
||||
};
|
||||
|
||||
//This ValueTraits will configure list and slist. In this case,
|
||||
//legacy_node_traits::node is the same as the
|
||||
//legacy_node_traits::node is the same as the
|
||||
//legacy_value_traits::value_type so to_node_ptr/to_value_ptr
|
||||
//functions are trivial.
|
||||
struct legacy_value_traits
|
||||
|
||||
@@ -27,7 +27,7 @@ class Window : public list_base_hook<>
|
||||
//Constructor. Includes this window in the list
|
||||
Window() { all_windows.push_back(*this); }
|
||||
//Destructor. Removes this node from the list
|
||||
virtual ~Window() { all_windows.erase(win_list::s_iterator_to(*this)); }
|
||||
virtual ~Window() { all_windows.erase(win_list::s_iterator_to(*this)); }
|
||||
//Pure virtual function to be implemented by derived classes
|
||||
virtual void Paint() = 0;
|
||||
};
|
||||
@@ -75,7 +75,7 @@ int main()
|
||||
MainWindow window;
|
||||
|
||||
//Paint all the windows, sub-windows and so on
|
||||
paint_all_windows();
|
||||
paint_all_windows();
|
||||
|
||||
//All the windows are automatically unregistered in their destructors.
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user