Ticket #12968: avl_test1.cpp

File avl_test1.cpp, 911 bytes (added by anonymous, 6 years ago)

File that does not compile any more

Line 
1#include <boost/intrusive/avl_set.hpp>
2
3typedef void *Type;
4
5struct EntryType {
6 EntryType(Type id) : id(id) {}
7 Type id;
8 typedef boost::intrusive::avl_set_member_hook <> AvlHook;
9 AvlHook avl_by_id_hook;
10 struct CompareById {
11 bool operator()(const EntryType &a,const EntryType &b) const
12 {return (a.id < b.id);}
13 };
14 struct KeyCompareById {
15 bool operator()(const Type &id,const EntryType &b) const
16 {return (id < b.id);}
17 bool operator()(const EntryType &a,const Type &id) const
18 {return (a.id < id);}
19 };
20};
21
22typedef boost::intrusive::avl_set<
23 EntryType,
24 boost::intrusive::member_hook<
25 EntryType,
26 EntryType::AvlHook,
27 &EntryType::avl_by_id_hook
28 >,
29 boost::intrusive::compare<EntryType::CompareById>
30 > SetById;
31
32void foo(SetById &s,const Type &x) {
33 s.find(x,EntryType::KeyCompareById());
34}
35