swiftiply 0.6.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTORS +2 -0
  3. data/README.md +62 -0
  4. data/bin/{mongrel_rails → evented_mongrel_rails} +6 -14
  5. data/bin/swiftiplied_mongrel_rails +246 -0
  6. data/bin/swiftiply +136 -116
  7. data/bin/swiftiply_mongrel_rails +2 -2
  8. data/bin/swiftiplyctl +283 -0
  9. data/cleanup.sh +5 -0
  10. data/ext/deque/extconf.rb +162 -0
  11. data/ext/deque/swiftcore/rubymain.cpp +435 -0
  12. data/ext/fastfilereader/extconf.rb +2 -2
  13. data/ext/fastfilereader/mapper.cpp +2 -0
  14. data/ext/map/extconf.rb +161 -0
  15. data/ext/map/rubymain.cpp +500 -0
  16. data/ext/splaytree/extconf.rb +161 -0
  17. data/ext/splaytree/swiftcore/rubymain.cpp +580 -0
  18. data/ext/splaytree/swiftcore/splay_map.h +635 -0
  19. data/ext/splaytree/swiftcore/splay_set.h +575 -0
  20. data/ext/splaytree/swiftcore/splay_tree.h +1127 -0
  21. data/external/httpclient.rb +231 -0
  22. data/external/package.rb +13 -13
  23. data/setup.rb +18 -2
  24. data/src/swiftcore/Swiftiply.rb +417 -773
  25. data/src/swiftcore/Swiftiply/backend_protocol.rb +213 -0
  26. data/src/swiftcore/Swiftiply/cache_base.rb +49 -0
  27. data/src/swiftcore/Swiftiply/cache_base_mixin.rb +52 -0
  28. data/src/swiftcore/Swiftiply/cluster_managers/rest_based_cluster_manager.rb +9 -0
  29. data/src/swiftcore/Swiftiply/cluster_protocol.rb +70 -0
  30. data/src/swiftcore/Swiftiply/config.rb +370 -0
  31. data/src/swiftcore/Swiftiply/config/rest_updater.rb +26 -0
  32. data/src/swiftcore/Swiftiply/constants.rb +101 -0
  33. data/src/swiftcore/Swiftiply/content_cache_entry.rb +44 -0
  34. data/src/swiftcore/Swiftiply/content_response.rb +45 -0
  35. data/src/swiftcore/Swiftiply/control_protocol.rb +49 -0
  36. data/src/swiftcore/Swiftiply/dynamic_request_cache.rb +41 -0
  37. data/src/swiftcore/Swiftiply/etag_cache.rb +64 -0
  38. data/src/swiftcore/Swiftiply/file_cache.rb +46 -0
  39. data/src/swiftcore/Swiftiply/hash_cache_base.rb +22 -0
  40. data/src/swiftcore/Swiftiply/http_recognizer.rb +267 -0
  41. data/src/swiftcore/Swiftiply/loggers/Analogger.rb +21 -0
  42. data/src/swiftcore/Swiftiply/loggers/stderror.rb +13 -0
  43. data/src/swiftcore/Swiftiply/mocklog.rb +10 -0
  44. data/src/swiftcore/Swiftiply/proxy.rb +15 -0
  45. data/src/swiftcore/Swiftiply/proxy_backends/keepalive.rb +286 -0
  46. data/src/swiftcore/Swiftiply/proxy_backends/traditional.rb +286 -0
  47. data/src/swiftcore/Swiftiply/proxy_backends/traditional/redis_directory.rb +87 -0
  48. data/src/swiftcore/Swiftiply/proxy_backends/traditional/static_directory.rb +69 -0
  49. data/src/swiftcore/Swiftiply/proxy_bag.rb +716 -0
  50. data/src/swiftcore/Swiftiply/rest_based_cluster_manager.rb +15 -0
  51. data/src/swiftcore/Swiftiply/splay_cache_base.rb +21 -0
  52. data/src/swiftcore/Swiftiply/support_pagecache.rb +6 -3
  53. data/src/swiftcore/Swiftiply/swiftiply_2_http_proxy.rb +7 -0
  54. data/src/swiftcore/Swiftiply/swiftiply_client.rb +20 -5
  55. data/src/swiftcore/Swiftiply/version.rb +5 -0
  56. data/src/swiftcore/evented_mongrel.rb +26 -8
  57. data/src/swiftcore/hash.rb +43 -0
  58. data/src/swiftcore/method_builder.rb +28 -0
  59. data/src/swiftcore/streamer.rb +46 -0
  60. data/src/swiftcore/swiftiplied_mongrel.rb +91 -23
  61. data/src/swiftcore/types.rb +20 -3
  62. data/swiftiply.gemspec +14 -8
  63. data/test/TC_Deque.rb +152 -0
  64. data/test/TC_ProxyBag.rb +147 -166
  65. data/test/TC_Swiftiply.rb +576 -169
  66. data/test/TC_Swiftiply/mongrel/evented_hello.rb +1 -1
  67. data/test/TC_Swiftiply/mongrel/swiftiplied_hello.rb +1 -1
  68. data/test/TC_Swiftiply/test_serve_static_file_xsendfile/sendfile_client.rb +27 -0
  69. data/test/TC_Swiftiply/test_ssl/bin/validate_ssl_capability.rb +21 -0
  70. data/test/TC_Swiftiply/test_ssl/test.cert +16 -0
  71. data/test/TC_Swiftiply/test_ssl/test.key +15 -0
  72. data/{bin → test/bin}/echo_client +0 -0
  73. metadata +136 -94
  74. data/README +0 -126
  75. data/ext/swiftiply_parse/parse.rl +0 -90
@@ -0,0 +1,575 @@
1
+ // splay_set.h -- implementation af a STL complatible set/multiset based on a splay tree.
2
+ //
3
+ // Copyright (c) 2004 Ralf Mattethat, Danish Technological Institute, Informatics
4
+ //
5
+ // Permission to copy, use, modify, sell and distribute this software
6
+ // is granted provided this copyright notice appears in all copies.
7
+ // This software is provided "as is" without express or implied
8
+ // warranty, and with no claim as to its suitability for any purpose.
9
+ //
10
+ // Please send questions, comments, complaints, performance data, etc to
11
+ // ralf.mattethat@teknologisk.dk
12
+
13
+ #ifndef SPLAY_SET_H_RMA13022003
14
+ #define SPLAY_SET_H_RMA13022003
15
+
16
+ #include "splay_tree.h"
17
+
18
+ #include <functional>
19
+
20
+ /* Requirements for element type
21
+ * must be copy-constructible
22
+ * destructor must not throw exception
23
+
24
+ Methods marked with note A only throws an exception if operator== or operator<
25
+ or the used predicate throws an exception
26
+
27
+ iterators are only invalidated, if the element pointed to by the iterator
28
+ is deleted. The same goes for element references
29
+ */
30
+
31
+ namespace swiftcore
32
+ {
33
+
34
+ template <typename T, typename Compare = std::less<T>, typename Allocator = std::allocator<T> >
35
+ class splay_set
36
+ {
37
+ // extract the keypart of a value of type T
38
+ struct KeyPart : public std::unary_function<T,T>
39
+ {
40
+ const T& operator()( const T& x ) const { return x; }
41
+ };
42
+
43
+ typedef detail::splay_tree<T, T, KeyPart, Compare, Allocator> Rep_type;
44
+
45
+ public:
46
+ // container
47
+ typedef typename Rep_type::key_type key_type;
48
+ typedef typename Rep_type::value_type value_type;
49
+ typedef Compare key_compare;
50
+ typedef Compare value_compare;
51
+ typedef typename Rep_type::reference reference;
52
+ typedef typename Rep_type::const_reference const_reference;
53
+ typedef typename Rep_type::size_type size_type;
54
+ typedef typename Rep_type::difference_type difference_type;
55
+
56
+ typedef typename Rep_type::allocator_type allocator_type;
57
+ typedef typename Rep_type::pointer pointer;
58
+ typedef typename Rep_type::const_pointer const_pointer;
59
+
60
+ // container
61
+ typedef typename Rep_type::const_iterator const_iterator;
62
+ typedef typename Rep_type::iterator iterator;
63
+
64
+
65
+ // reversible container
66
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
67
+ typedef std::reverse_iterator<iterator> reverse_iterator;
68
+
69
+ /////////////////////////////////////////////////////////////////
70
+ // construct/copy/destroy:
71
+
72
+ // container | complexity : constant | exception :
73
+ explicit splay_set( const Compare& comp = Compare(), const allocator_type& a = Allocator() )
74
+ : rep_( comp, a )
75
+
76
+ { }
77
+
78
+ // associative sequence | complexity : linear/NlogN | exception :
79
+ template <typename InputIterator>
80
+ splay_set( InputIterator first, InputIterator last, const Compare& comp = Compare(), const allocator_type& a = Allocator() )
81
+ : rep_( comp, a )
82
+ { insert( first, last ); }
83
+
84
+ // container | complexity : linear | exception :
85
+ splay_set( const splay_set& x )
86
+ : rep_( x.rep_.key_comp(), x.rep_.get_allocator() )
87
+ { insert( x.begin(), x.end() ); }
88
+
89
+ // container | complexity : linear | exception : nothrow
90
+ ~splay_set() { }
91
+
92
+ // container | complexity : linear | exception : strong
93
+ splay_set& operator= ( const splay_set& rhs )
94
+ {
95
+ splay_set temp( rhs );
96
+ swap( temp );
97
+ return *this;
98
+ }
99
+
100
+ // | complexity : constant | exception : nothrow
101
+ allocator_type get_allocator() const { return rep_.get_allocator(); }
102
+
103
+
104
+ /////////////////////////////////////////////////////////////////
105
+ // iterators:
106
+
107
+ // container | complexity : constant | exception : nothrow
108
+ iterator begin() { return rep_.begin(); }
109
+ const_iterator begin() const { return rep_.begin(); }
110
+ iterator end() { return rep_.end(); }
111
+ const_iterator end() const { return rep_.end(); }
112
+
113
+ // reversible container | complexity : constant | exception : nothrow
114
+ reverse_iterator rbegin() { return reverse_iterator( end() ); }
115
+ const_reverse_iterator rbegin() const { return const_reverse_iterator( end() ); }
116
+ reverse_iterator rend() { return reverse_iterator( begin() ); }
117
+ const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); }
118
+
119
+
120
+ /////////////////////////////////////////////////////////////////
121
+ // capacity:
122
+
123
+ // container | complexity : constant | exception : nothrow
124
+ bool empty() const { return rep_.empty(); }
125
+
126
+ // container | complexity : constant | exception : nothrow
127
+ size_type size() const { return rep_.size(); }
128
+
129
+ // container | complexity : constant | exception : nothrow
130
+ size_type max_size() const { return rep_.max_size(); }
131
+
132
+
133
+ /////////////////////////////////////////////////////////////////
134
+ // modifiers:
135
+
136
+ // associative sequence | complexity : logarithmic | exception : strong
137
+ std::pair<iterator, bool> insert( const value_type& x )
138
+ {
139
+ return rep_.insert_unique( x );
140
+ }
141
+
142
+ // associative sequence | complexity : constant/logarithmic | exception : strong
143
+ iterator insert( iterator position, const value_type& x )
144
+ {
145
+ return rep_.insert_unique( position, x );
146
+ }
147
+
148
+ // associative sequence | complexity : linear/NlogN | exception : weak
149
+ template <typename InputIterator>
150
+ void insert( InputIterator first, InputIterator last )
151
+ {
152
+ rep_.insert_unique( first, last );
153
+ }
154
+
155
+ // associative sequence | complexity : logarithmic | exception : strong, note A
156
+ size_type erase( const key_type& x )
157
+ {
158
+ return rep_.erase( x );
159
+ }
160
+
161
+ // associative sequence | complexity : constant | exception : nothrow
162
+ void erase( iterator position )
163
+ {
164
+ rep_.erase( position );
165
+ }
166
+
167
+ // associative sequence | complexity : d logN | exception : nothrow
168
+ void erase( iterator first, iterator last )
169
+ {
170
+ rep_.erase( first, last );
171
+ }
172
+
173
+ // associative sequence | complexity : linear | exception : nothrow
174
+ void clear()
175
+ {
176
+ rep_.clear();
177
+ }
178
+
179
+ // container | complexity : constant | exception : nothrow
180
+ void swap( splay_set& x )
181
+ {
182
+ rep_.swap( x.rep_ );
183
+ }
184
+
185
+
186
+ /////////////////////////////////////////////////////////////////
187
+ // observers:
188
+
189
+ // associative sequence | complexity : constant | exception : nothrow
190
+ key_compare key_comp() const { return rep_.key_comp(); }
191
+ value_compare value_comp() const { return rep_.key_comp(); }
192
+
193
+
194
+ /////////////////////////////////////////////////////////////////
195
+ // set operations:
196
+
197
+ // associative sequence | complexity : logarithmic | exception : strong, note A
198
+ iterator find( const key_type& x )
199
+ {
200
+ return rep_.find( x );
201
+ }
202
+
203
+ // associative sequence | complexity : logarithmic | exception : strong, note A
204
+ const_iterator find( const key_type& x ) const
205
+ {
206
+ return rep_.find( x );
207
+ }
208
+
209
+ // associative sequence | complexity : logarithmic | exception : strong, note A
210
+ size_type count( const key_type& x ) const
211
+ {
212
+ return rep_.count( x );
213
+ }
214
+
215
+ // associative sequence | complexity : logarithmic | exception : strong, note A
216
+ iterator lower_bound( const key_type& x )
217
+ {
218
+ return rep_.lower_bound( x );
219
+ }
220
+
221
+ // associative sequence | complexity : logarithmic | exception : strong, note A
222
+ const_iterator lower_bound( const key_type& x ) const
223
+ {
224
+ return rep_.lower_bound( x );
225
+ }
226
+
227
+ // associative sequence | complexity : logarithmic | exception : strong, note A
228
+ iterator upper_bound( const key_type& x )
229
+ {
230
+ return rep_.upper_bound( x );
231
+ }
232
+
233
+ // associative sequence | complexity : logarithmic | exception : strong, note A
234
+ const_iterator upper_bound( const key_type& x ) const
235
+ {
236
+ return rep_.upper_bound( x );
237
+ }
238
+
239
+ // associative sequence | complexity : logarithmic | exception : strong, note A
240
+ std::pair<iterator, iterator> equal_range( const key_type& x )
241
+ {
242
+ return rep_.equal_range( x );
243
+ }
244
+
245
+ // associative sequence | complexity : logarithmic | exception : strong, note A
246
+ std::pair<const_iterator, const_iterator> equal_range( const key_type& x ) const
247
+ {
248
+ return rep_.equal_range( x );
249
+ }
250
+
251
+ private:
252
+ Rep_type rep_;
253
+ };
254
+
255
+ template <typename T, typename Compare = std::less<T>, typename Allocator = std::allocator<T> >
256
+ class splay_multiset
257
+ {
258
+ // extract the keypart of a value of type T
259
+ struct KeyPart : public std::unary_function<T,T>
260
+ {
261
+ const T& operator()( const T& x ) const { return x; }
262
+ };
263
+
264
+ typedef detail::splay_tree<T, T, KeyPart, Compare, Allocator> Rep_type;
265
+
266
+ public:
267
+ // container
268
+ typedef typename Rep_type::key_type key_type;
269
+ typedef typename Rep_type::value_type value_type;
270
+ typedef Compare key_compare;
271
+ typedef Compare value_compare;
272
+ typedef typename Rep_type::reference reference;
273
+ typedef typename Rep_type::const_reference const_reference;
274
+ typedef typename Rep_type::size_type size_type;
275
+ typedef typename Rep_type::difference_type difference_type;
276
+
277
+ typedef typename Rep_type::allocator_type allocator_type;
278
+ typedef typename Rep_type::pointer pointer;
279
+ typedef typename Rep_type::const_pointer const_pointer;
280
+
281
+ // container
282
+ typedef typename Rep_type::const_iterator const_iterator;
283
+ typedef typename Rep_type::iterator iterator;
284
+
285
+
286
+ // reversible container
287
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
288
+ typedef std::reverse_iterator<iterator> reverse_iterator;
289
+
290
+ /////////////////////////////////////////////////////////////////
291
+ // construct/copy/destroy:
292
+
293
+ // container | complexity : constant | exception :
294
+ explicit splay_multiset( const Compare& comp = Compare(), const allocator_type& a = Allocator() )
295
+ : rep_( comp, a )
296
+ { }
297
+
298
+ // associative sequence | complexity : linear/NlogN | exception :
299
+ template <typename InputIterator>
300
+ splay_multiset( InputIterator first, InputIterator last, const Compare& comp = Compare(), const allocator_type& a = Allocator() )
301
+ : rep_( comp, a )
302
+ { insert( first, last ); }
303
+
304
+ // container | complexity : linear | exception :
305
+ splay_multiset( const splay_multiset& x )
306
+ : rep_( x.rep_.key_comp(), x.rep_.get_allocator() )
307
+ { insert( x.begin(), x.end() ); }
308
+
309
+ // container | complexity : linear | exception : nothrow
310
+ ~splay_multiset() { }
311
+
312
+ // container | complexity : linear | exception : strong
313
+ splay_multiset& operator= ( const splay_multiset& rhs )
314
+ {
315
+ splay_multiset temp( rhs );
316
+ swap( temp );
317
+ return *this;
318
+ }
319
+
320
+ // | complexity : constant | exception : nothrow
321
+ allocator_type get_allocator() const { return rep_.get_allocator(); }
322
+
323
+
324
+ /////////////////////////////////////////////////////////////////
325
+ // iterators:
326
+
327
+ // container | complexity : constant | exception : nothrow
328
+ iterator begin() { return rep_.begin(); }
329
+ const_iterator begin() const { return rep_.begin(); }
330
+ iterator end() { return rep_.end(); }
331
+ const_iterator end() const { return rep_.end(); }
332
+
333
+ // reversible container | complexity : constant | exception : nothrow
334
+ reverse_iterator rbegin() { return reverse_iterator( end() ); }
335
+ const_reverse_iterator rbegin() const { return const_reverse_iterator( end() ); }
336
+ reverse_iterator rend() { return reverse_iterator( begin() ); }
337
+ const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); }
338
+
339
+
340
+ /////////////////////////////////////////////////////////////////
341
+ // capacity:
342
+
343
+ // container | complexity : constant | exception : nothrow
344
+ bool empty() const { return rep_.empty(); }
345
+
346
+ // container | complexity : constant | exception : nothrow
347
+ size_type size() const { return rep_.size(); }
348
+
349
+ // container | complexity : constant | exception : nothrow
350
+ size_type max_size() const { return rep_.max_size(); }
351
+
352
+
353
+ /////////////////////////////////////////////////////////////////
354
+ // modifiers:
355
+
356
+ // associative sequence | complexity : logarithmic | exception : strong
357
+ iterator insert( const value_type& x )
358
+ {
359
+ return rep_.insert_equal( x );
360
+ }
361
+
362
+ // associative sequence | complexity : constant/logarithmic | exception : strong
363
+ iterator insert( iterator position, const value_type& x )
364
+ {
365
+ return rep_.insert_equal( position, x );
366
+ }
367
+
368
+ // associative sequence | complexity : linear/NlogN | exception : weak
369
+ template <typename InputIterator>
370
+ void insert( InputIterator first, InputIterator last )
371
+ {
372
+ rep_.insert_equal( first, last );
373
+ }
374
+
375
+ // associative sequence | complexity : logarithmic | exception : strong, note A
376
+ size_type erase( const key_type& x )
377
+ {
378
+ return rep_.erase( x );
379
+ }
380
+
381
+ // associative sequence | complexity : constant | exception : nothrow
382
+ void erase( iterator position )
383
+ {
384
+ rep_.erase( position );
385
+ }
386
+
387
+ // associative sequence | complexity : d logN | exception : nothrow
388
+ void erase( iterator first, iterator last )
389
+ {
390
+ rep_.erase( first, last );
391
+ }
392
+
393
+ // associative sequence | complexity : linear | exception : nothrow
394
+ void clear()
395
+ {
396
+ rep_.clear();
397
+ }
398
+
399
+ // container | complexity : constant | exception : nothrow
400
+ void swap( splay_multiset& x )
401
+ {
402
+ rep_.swap( x.rep_ );
403
+ }
404
+
405
+
406
+ /////////////////////////////////////////////////////////////////
407
+ // observers:
408
+
409
+ // associative sequence | complexity : constant | exception : nothrow
410
+ key_compare key_comp() const { return rep_.key_comp(); }
411
+ value_compare value_comp() const { return rep_.key_comp(); }
412
+
413
+
414
+ /////////////////////////////////////////////////////////////////
415
+ // set operations:
416
+
417
+ // associative sequence | complexity : logarithmic | exception : strong, note A
418
+ iterator find( const key_type& x )
419
+ {
420
+ return rep_.find( x );
421
+ }
422
+
423
+ // associative sequence | complexity : logarithmic | exception : strong, note A
424
+ const_iterator find( const key_type& x ) const
425
+ {
426
+ return rep_.find( x );
427
+ }
428
+
429
+ // associative sequence | complexity : logarithmic | exception : strong, note A
430
+ size_type count( const key_type& x ) const
431
+ {
432
+ return rep_.count( x );
433
+ }
434
+
435
+ // associative sequence | complexity : logarithmic | exception : strong, note A
436
+ iterator lower_bound( const key_type& x )
437
+ {
438
+ return rep_.lower_bound( x );
439
+ }
440
+
441
+ // associative sequence | complexity : logarithmic | exception : strong, note A
442
+ const_iterator lower_bound( const key_type& x ) const
443
+ {
444
+ return rep_.lower_bound( x );
445
+ }
446
+
447
+ // associative sequence | complexity : logarithmic | exception : strong, note A
448
+ iterator upper_bound( const key_type& x )
449
+ {
450
+ return rep_.upper_bound( x );
451
+ }
452
+
453
+ // associative sequence | complexity : logarithmic | exception : strong, note A
454
+ const_iterator upper_bound( const key_type& x ) const
455
+ {
456
+ return rep_.upper_bound( x );
457
+ }
458
+
459
+ // associative sequence | complexity : logarithmic | exception : strong, note A
460
+ std::pair<iterator, iterator> equal_range( const key_type& x )
461
+ {
462
+ return rep_.equal_range( x );
463
+ }
464
+
465
+ // associative sequence | complexity : logarithmic | exception : strong, note A
466
+ std::pair<const_iterator, const_iterator> equal_range( const key_type& x ) const
467
+ {
468
+ return rep_.equal_range( x );
469
+ }
470
+
471
+ private:
472
+ Rep_type rep_;
473
+ };
474
+
475
+ // container | complexity : linear | exception : strong, note A
476
+ template <typename T, typename Compare, typename Allocator>
477
+ inline bool operator == ( const splay_set<T, Compare, Allocator>& lhs, const splay_set<T, Compare, Allocator>& rhs )
478
+ {
479
+ return lhs.size() == rhs.size() && std::equal( lhs.begin(), lhs.end(), rhs.begin() );
480
+ }
481
+
482
+ // container | complexity : linear | exception : strong, note A
483
+ template <typename T, typename Compare, typename Allocator>
484
+ inline bool operator < ( const splay_set<T, Compare, Allocator>& lhs, const splay_set<T, Compare, Allocator>& rhs )
485
+ {
486
+ return std::lexicographical_compare( lhs.begin(), lhs.end(), rhs.begin(), rhs.end() );
487
+ }
488
+
489
+ // container | complexity : linear | exception : strong, note A
490
+ template <typename T, typename Compare, typename Allocator>
491
+ inline bool operator != ( const splay_set<T, Compare, Allocator>& lhs, const splay_set<T, Compare, Allocator>& rhs )
492
+ {
493
+ return !( lhs == rhs );
494
+ }
495
+
496
+ // container | complexity : linear | exception : strong, note A
497
+ template <typename T, typename Compare, typename Allocator>
498
+ inline bool operator > ( const splay_set<T, Compare, Allocator>& lhs, const splay_set<T, Compare, Allocator>& rhs )
499
+ {
500
+ return rhs < lhs;
501
+ }
502
+
503
+ // container | complexity : linear | exception : strong, note A
504
+ template <typename T, typename Compare, typename Allocator>
505
+ inline bool operator <= ( const splay_set<T, Compare, Allocator>& lhs, const splay_set<T, Compare, Allocator>& rhs )
506
+ {
507
+ return !( rhs < lhs );
508
+ }
509
+
510
+ // container | complexity : linear | exception : strong, note A
511
+ template <typename T, typename Compare, typename Allocator>
512
+ inline bool operator >= ( const splay_set<T, Compare, Allocator>& lhs, const splay_set<T, Compare, Allocator>& rhs )
513
+ {
514
+ return !( lhs < rhs );
515
+ }
516
+
517
+ // container | complexity : constant | exception : nothrow
518
+ template <typename T, typename Compare, typename Allocator>
519
+ inline void swap( splay_set<T, Compare, Allocator>& x, splay_set<T, Compare, Allocator>& y )
520
+ {
521
+ x.swap( y );
522
+ }
523
+
524
+ // container | complexity : linear | exception : strong, note A
525
+ template <typename T, typename Compare, typename Allocator>
526
+ inline bool operator == ( const splay_multiset<T, Compare, Allocator>& lhs, const splay_multiset<T, Compare, Allocator>& rhs )
527
+ {
528
+ return lhs.size() == rhs.size() && std::equal( lhs.begin(), lhs.end(), rhs.begin() );
529
+ }
530
+
531
+ // container | complexity : linear | exception : strong, note A
532
+ template <typename T, typename Compare, typename Allocator>
533
+ inline bool operator < ( const splay_multiset<T, Compare, Allocator>& lhs, const splay_multiset<T, Compare, Allocator>& rhs )
534
+ {
535
+ return std::lexicographical_compare( lhs.begin(), lhs.end(), rhs.begin(), rhs.end() );
536
+ }
537
+
538
+ // container | complexity : linear | exception : strong, note A
539
+ template <typename T, typename Compare, typename Allocator>
540
+ inline bool operator != ( const splay_multiset<T, Compare, Allocator>& lhs, const splay_multiset<T, Compare, Allocator>& rhs )
541
+ {
542
+ return !( lhs == rhs );
543
+ }
544
+
545
+ // container | complexity : linear | exception : strong, note A
546
+ template <typename T, typename Compare, typename Allocator>
547
+ inline bool operator > ( const splay_multiset<T, Compare, Allocator>& lhs, const splay_multiset<T, Compare, Allocator>& rhs )
548
+ {
549
+ return rhs < lhs;
550
+ }
551
+
552
+ // container | complexity : linear | exception : strong, note A
553
+ template <typename T, typename Compare, typename Allocator>
554
+ inline bool operator <= ( const splay_multiset<T, Compare, Allocator>& lhs, const splay_multiset<T, Compare, Allocator>& rhs )
555
+ {
556
+ return !( rhs < lhs );
557
+ }
558
+
559
+ // container | complexity : linear | exception : strong, note A
560
+ template <typename T, typename Compare, typename Allocator>
561
+ inline bool operator >= ( const splay_multiset<T, Compare, Allocator>& lhs, const splay_multiset<T, Compare, Allocator>& rhs )
562
+ {
563
+ return !( lhs < rhs );
564
+ }
565
+
566
+ // container | complexity : constant | exception : nothrow
567
+ template <typename T, typename Compare, typename Allocator>
568
+ inline void swap( splay_multiset<T, Compare, Allocator>& x, splay_multiset<T, Compare, Allocator>& y )
569
+ {
570
+ x.swap( y );
571
+ }
572
+
573
+ } // namespace swiftcore
574
+
575
+ #endif // SPLAY_SET_H_RMA13022003