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,635 @@
1
+ // splay_map.h -- implementation af a STL complatible map/multimap 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_MAP_H_RMA13022003
14
+ #define SPLAY_MAP_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 K, typename T, typename Compare = std::less<K>, typename Allocator = std::allocator<std::pair<const K,T> > >
35
+ class splay_map
36
+ {
37
+ public:
38
+ // container
39
+ typedef K key_type;
40
+ typedef std::pair<const K,T> value_type;
41
+
42
+ private:
43
+ // extract the keypart of a value of type value_type
44
+ struct KeyPart : public std::unary_function<value_type,key_type>
45
+ {
46
+ const key_type& operator()( const value_type& x ) const { return x.first; }
47
+ };
48
+
49
+ typedef detail::splay_tree<K, value_type, KeyPart, Compare, Allocator> Rep_type;
50
+
51
+ public:
52
+
53
+ // map
54
+ typedef T mapped_type;
55
+ typedef Compare key_compare;
56
+
57
+ // map
58
+ class value_compare : public std::binary_function<value_type, value_type, bool>
59
+ {
60
+ friend class splay_map<K,T,Compare,Allocator>;
61
+ protected:
62
+ Compare comp;
63
+ value_compare( Compare c ) : comp( c ) { }
64
+
65
+ public:
66
+ bool operator()( const value_type& x, const value_type& y ) const
67
+ {
68
+ return comp( x.first, y.first );
69
+ }
70
+ };
71
+
72
+
73
+ // container
74
+ typedef typename Rep_type::reference reference;
75
+ typedef typename Rep_type::const_reference const_reference;
76
+ typedef typename Rep_type::size_type size_type;
77
+ typedef typename Rep_type::difference_type difference_type;
78
+
79
+ typedef typename Rep_type::allocator_type allocator_type;
80
+ typedef typename Rep_type::pointer pointer;
81
+ typedef typename Rep_type::const_pointer const_pointer;
82
+
83
+ // container
84
+ typedef typename Rep_type::const_iterator const_iterator;
85
+ typedef typename Rep_type::iterator iterator;
86
+
87
+
88
+ // reversible container
89
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
90
+ typedef std::reverse_iterator<iterator> reverse_iterator;
91
+
92
+ /////////////////////////////////////////////////////////////////
93
+ // construct/copy/destroy:
94
+
95
+ // container | complexity : constant | exception :
96
+ explicit splay_map( const key_compare& comp = Compare(), const allocator_type& a = Allocator() )
97
+ : rep_( comp, a )
98
+ { }
99
+
100
+ // associative sequence | complexity : NlogN | exception :
101
+ template <typename InputIterator>
102
+ splay_map( InputIterator first, InputIterator last, const key_compare& comp = Compare(), const allocator_type& a = Allocator() )
103
+ : rep_( comp, a )
104
+ { insert( first, last ); }
105
+
106
+ // container | complexity : linear | exception :
107
+ splay_map( const splay_map& x )
108
+ : rep_( x.rep_.key_comp(), x.rep_.get_allocator() )
109
+ { insert( x.begin(), x.end() ); }
110
+
111
+ // container | complexity : linear | exception : nothrow
112
+ ~splay_map() { }
113
+
114
+ // container | complexity : linear | exception : strong
115
+ splay_map& operator= ( const splay_map& rhs )
116
+ {
117
+ splay_map temp( rhs );
118
+ swap( temp );
119
+ return *this;
120
+ }
121
+
122
+ // | complexity : constant | exception : nothrow
123
+ allocator_type get_allocator() const { return rep_.get_allocator(); }
124
+
125
+
126
+ /////////////////////////////////////////////////////////////////
127
+ // iterators:
128
+
129
+ // container | complexity : constant | exception : nothrow
130
+ iterator begin() { return rep_.begin(); }
131
+ const_iterator begin() const { return rep_.begin(); }
132
+ iterator end() { return rep_.end(); }
133
+ const_iterator end() const { return rep_.end(); }
134
+ iterator parent() { return rep_.parent(); }
135
+ const_iterator parent() const { return rep_.parent(); }
136
+ void erase_childfree_nodes() {rep_.erase_childfree_nodes();}
137
+ void set_max_permitted_size(int sz) {rep_.set_max_permitted_size(sz);};
138
+ int get_max_permitted_size() {return rep_.get_max_permitted_size();};
139
+
140
+ // reversible container | complexity : constant | exception : nothrow
141
+ reverse_iterator rbegin() { return reverse_iterator( end() ); }
142
+ const_reverse_iterator rbegin() const { return const_reverse_iterator( end() ); }
143
+ reverse_iterator rend() { return reverse_iterator( begin() ); }
144
+ const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); }
145
+
146
+
147
+ /////////////////////////////////////////////////////////////////
148
+ // capacity:
149
+
150
+ // container | complexity : constant | exception : nothrow
151
+ bool empty() const { return rep_.empty(); }
152
+
153
+ // container | complexity : constant | exception : nothrow
154
+ size_type size() const { return rep_.size(); }
155
+
156
+ // container | complexity : constant | exception : nothrow
157
+ size_type max_size() const { return rep_.max_size(); }
158
+
159
+
160
+ /////////////////////////////////////////////////////////////////
161
+ // element access:
162
+
163
+ // | complexity : logarithmic | exception : strong
164
+ mapped_type& operator[] ( const key_type& x )
165
+ {
166
+ return ( *( insert( std::make_pair(x, mapped_type() ) ).first ) ).second;
167
+ }
168
+
169
+
170
+ /////////////////////////////////////////////////////////////////
171
+ // modifiers:
172
+
173
+ // associative sequence | complexity : logarithmic | exception : strong
174
+ std::pair<iterator, bool> insert( const value_type& x )
175
+ {
176
+ return rep_.insert_unique( x );
177
+ }
178
+
179
+ // associative sequence | complexity : constant/logarithmic | exception : strong
180
+ iterator insert( iterator position, const value_type& x )
181
+ {
182
+ return rep_.insert_unique( position, x );
183
+ }
184
+
185
+ // associative sequence | complexity : NlogN | exception : weak
186
+ template <typename InputIterator>
187
+ void insert( InputIterator first, InputIterator last )
188
+ {
189
+ rep_.insert_unique( first, last );
190
+ }
191
+
192
+ // associative sequence | complexity : logarithmic | exception : strong, note A
193
+ size_type erase( const key_type& x )
194
+ {
195
+ return rep_.erase( x );
196
+ }
197
+
198
+ // associative sequence | complexity : constant | exception : nothrow
199
+ void erase( iterator position )
200
+ {
201
+ rep_.erase( position );
202
+ }
203
+
204
+ // associative sequence | complexity : linear | exception : nothrow
205
+ void erase( iterator first, iterator last )
206
+ {
207
+ rep_.erase( first, last );
208
+ }
209
+
210
+ // associative sequence | complexity : linear | exception : nothrow
211
+ void clear()
212
+ {
213
+ rep_.clear();
214
+ }
215
+
216
+ // container | complexity : constant | exception : nothrow
217
+ void swap( splay_map& x )
218
+ {
219
+ rep_.swap( x.rep_ );
220
+ }
221
+
222
+
223
+ /////////////////////////////////////////////////////////////////
224
+ // observers:
225
+
226
+ // associative sequence | complexity : constant | exception : nothrow
227
+ key_compare key_comp() const { return rep_.key_comp(); }
228
+ value_compare value_comp() const { return value_compare( rep_.key_comp() ); }
229
+
230
+
231
+ /////////////////////////////////////////////////////////////////
232
+ // map operations:
233
+
234
+ // associative sequence | complexity : logarithmic | exception : strong, note A
235
+ iterator find( const key_type& x )
236
+ {
237
+ return rep_.find( x );
238
+ }
239
+
240
+ // associative sequence | complexity : logarithmic | exception : strong, note A
241
+ const_iterator find( const key_type& x ) const
242
+ {
243
+ return rep_.find( x );
244
+ }
245
+
246
+ // associative sequence | complexity : logarithmic | exception : strong, note A
247
+ size_type count( const key_type& x ) const
248
+ {
249
+ return rep_.count( x );
250
+ }
251
+
252
+ // associative sequence | complexity : logarithmic | exception : strong, note A
253
+ iterator lower_bound( const key_type& x )
254
+ {
255
+ return rep_.lower_bound( x );
256
+ }
257
+
258
+ // associative sequence | complexity : logarithmic | exception : strong, note A
259
+ const_iterator lower_bound( const key_type& x ) const
260
+ {
261
+ return rep_.lower_bound( x );
262
+ }
263
+
264
+ // associative sequence | complexity : logarithmic | exception : strong, note A
265
+ iterator upper_bound( const key_type& x )
266
+ {
267
+ return rep_.upper_bound( x );
268
+ }
269
+
270
+ // associative sequence | complexity : logarithmic | exception : strong, note A
271
+ const_iterator upper_bound( const key_type& x ) const
272
+ {
273
+ return rep_.upper_bound( x );
274
+ }
275
+
276
+ // associative sequence | complexity : logarithmic | exception : strong, note A
277
+ std::pair<iterator, iterator> equal_range( const key_type& x )
278
+ {
279
+ return rep_.equal_range( x );
280
+ }
281
+
282
+ // associative sequence | complexity : logarithmic | exception : strong, note A
283
+ std::pair<const_iterator, const_iterator> equal_range( const key_type& x ) const
284
+ {
285
+ return rep_.equal_range( x );
286
+ }
287
+
288
+ private:
289
+ Rep_type rep_;
290
+ };
291
+
292
+ template <typename K, typename T, typename Compare = std::less<K>, typename Allocator = std::allocator<std::pair<const K,T> > >
293
+ class splay_multimap
294
+ {
295
+ public:
296
+ // container
297
+ typedef K key_type;
298
+ typedef std::pair<const K,T> value_type;
299
+
300
+ private:
301
+ // extract the keypart of a value of type value_type
302
+ struct KeyPart : public std::unary_function<value_type,key_type>
303
+ {
304
+ const key_type& operator()( const value_type& x ) const { return x.first; }
305
+ };
306
+
307
+ typedef detail::splay_tree<K, value_type, KeyPart, Compare, Allocator> Rep_type;
308
+
309
+ public:
310
+
311
+ // map
312
+ typedef T mapped_type;
313
+ typedef Compare key_compare;
314
+
315
+ // map
316
+ class value_compare : public std::binary_function<value_type, value_type, bool>
317
+ {
318
+ friend class splay_multimap<K,T,Compare,Allocator>;
319
+ protected:
320
+ Compare comp;
321
+ value_compare( Compare c ) : comp( c ) { }
322
+
323
+ public:
324
+ bool operator()( const value_type& x, const value_type& y ) const
325
+ {
326
+ return comp( x.first, y.first );
327
+ }
328
+ };
329
+
330
+
331
+ // container
332
+ typedef typename Rep_type::reference reference;
333
+ typedef typename Rep_type::const_reference const_reference;
334
+ typedef typename Rep_type::size_type size_type;
335
+ typedef typename Rep_type::difference_type difference_type;
336
+
337
+ typedef typename Rep_type::allocator_type allocator_type;
338
+ typedef typename Rep_type::pointer pointer;
339
+ typedef typename Rep_type::const_pointer const_pointer;
340
+
341
+ // container
342
+ typedef typename Rep_type::const_iterator const_iterator;
343
+ typedef typename Rep_type::iterator iterator;
344
+
345
+
346
+ // reversible container
347
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
348
+ typedef std::reverse_iterator<iterator> reverse_iterator;
349
+
350
+ /////////////////////////////////////////////////////////////////
351
+ // construct/copy/destroy:
352
+
353
+ // container | complexity : constant | exception :
354
+ explicit splay_multimap( const key_compare& comp = Compare(), const allocator_type& a = Allocator() )
355
+ : rep_( comp, a )
356
+ { }
357
+
358
+ // associative sequence | complexity : NlogN | exception :
359
+ template <typename InputIterator>
360
+ splay_multimap( InputIterator first, InputIterator last, const key_compare& comp = Compare(), const allocator_type& a = Allocator() )
361
+ : rep_( comp, a )
362
+ { insert( first, last ); }
363
+
364
+ // container | complexity : linear | exception :
365
+ splay_multimap( const splay_multimap& x )
366
+ : rep_( x.rep_.key_comp(), x.rep_.get_allocator() )
367
+ { insert( x.begin(), x.end() ); }
368
+
369
+ // container | complexity : linear | exception : nothrow
370
+ ~splay_multimap() { }
371
+
372
+ // container | complexity : linear | exception : strong
373
+ splay_multimap& operator= ( const splay_multimap& rhs )
374
+ {
375
+ splay_multimap temp( rhs );
376
+ swap( temp );
377
+ return *this;
378
+ }
379
+
380
+ // | complexity : constant | exception : nothrow
381
+ allocator_type get_allocator() const { return rep_.get_allocator(); }
382
+
383
+
384
+ /////////////////////////////////////////////////////////////////
385
+ // iterators:
386
+
387
+ // container | complexity : constant | exception : nothrow
388
+ iterator begin() { return rep_.begin(); }
389
+ const_iterator begin() const { return rep_.begin(); }
390
+ iterator end() { return rep_.end(); }
391
+ const_iterator end() const { return rep_.end(); }
392
+
393
+ // reversible container | complexity : constant | exception : nothrow
394
+ reverse_iterator rbegin() { return reverse_iterator( end() ); }
395
+ const_reverse_iterator rbegin() const { return const_reverse_iterator( end() ); }
396
+ reverse_iterator rend() { return reverse_iterator( begin() ); }
397
+ const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); }
398
+
399
+
400
+ /////////////////////////////////////////////////////////////////
401
+ // capacity:
402
+
403
+ // container | complexity : constant | exception : nothrow
404
+ bool empty() const { return rep_.empty(); }
405
+
406
+ // container | complexity : constant | exception : nothrow
407
+ size_type size() const { return rep_.size(); }
408
+
409
+ // container | complexity : constant | exception : nothrow
410
+ size_type max_size() const { return rep_.max_size(); }
411
+
412
+
413
+ /////////////////////////////////////////////////////////////////
414
+ // modifiers:
415
+
416
+ // associative sequence | complexity : logarithmic | exception : strong
417
+ iterator insert( const value_type& x )
418
+ {
419
+ return rep_.insert_equal( x );
420
+ }
421
+
422
+ // associative sequence | complexity : constant/logarithmic | exception : strong
423
+ iterator insert( iterator position, const value_type& x )
424
+ {
425
+ return rep_.insert_equal( position, x );
426
+ }
427
+
428
+ // associative sequence | complexity : NlogN | exception : weak
429
+ template <typename InputIterator>
430
+ void insert( InputIterator first, InputIterator last )
431
+ {
432
+ rep_.insert_equal( first, last );
433
+ }
434
+
435
+ // associative sequence | complexity : logarithmic | exception : strong, note A
436
+ size_type erase( const key_type& x )
437
+ {
438
+ return rep_.erase( x );
439
+ }
440
+
441
+ // associative sequence | complexity : constant | exception : nothrow
442
+ void erase( iterator position )
443
+ {
444
+ rep_.erase( position );
445
+ }
446
+
447
+ // associative sequence | complexity : linear | exception : nothrow
448
+ void erase( iterator first, iterator last )
449
+ {
450
+ rep_.erase( first, last );
451
+ }
452
+
453
+ // associative sequence | complexity : linear | exception : nothrow
454
+ void clear()
455
+ {
456
+ rep_.clear();
457
+ }
458
+
459
+ // container | complexity : constant | exception : nothrow
460
+ void swap( splay_multimap& x )
461
+ {
462
+ rep_.swap( x.rep_ );
463
+ }
464
+
465
+
466
+ /////////////////////////////////////////////////////////////////
467
+ // observers:
468
+
469
+ // associative sequence | complexity : constant | exception : nothrow
470
+ key_compare key_comp() const { return rep_.key_comp(); }
471
+ value_compare value_comp() const { return value_compare( rep_.key_comp() ); }
472
+
473
+
474
+ /////////////////////////////////////////////////////////////////
475
+ // map operations:
476
+
477
+ // associative sequence | complexity : logarithmic | exception : strong, note A
478
+ iterator find( const key_type& x )
479
+ {
480
+ return rep_.find( x );
481
+ }
482
+
483
+ // associative sequence | complexity : logarithmic | exception : strong, note A
484
+ const_iterator find( const key_type& x ) const
485
+ {
486
+ return rep_.find( x );
487
+ }
488
+
489
+ // associative sequence | complexity : logarithmic | exception : strong, note A
490
+ size_type count( const key_type& x ) const
491
+ {
492
+ return rep_.count( x );
493
+ }
494
+
495
+ // associative sequence | complexity : logarithmic | exception : strong, note A
496
+ iterator lower_bound( const key_type& x )
497
+ {
498
+ return rep_.lower_bound( x );
499
+ }
500
+
501
+ // associative sequence | complexity : logarithmic | exception : strong, note A
502
+ const_iterator lower_bound( const key_type& x ) const
503
+ {
504
+ return rep_.lower_bound( x );
505
+ }
506
+
507
+ // associative sequence | complexity : logarithmic | exception : strong, note A
508
+ iterator upper_bound( const key_type& x )
509
+ {
510
+ return rep_.upper_bound( x );
511
+ }
512
+
513
+ // associative sequence | complexity : logarithmic | exception : strong, note A
514
+ const_iterator upper_bound( const key_type& x ) const
515
+ {
516
+ return rep_.upper_bound( x );
517
+ }
518
+
519
+ // associative sequence | complexity : logarithmic | exception : strong, note A
520
+ std::pair<iterator, iterator> equal_range( const key_type& x )
521
+ {
522
+ return rep_.equal_range( x );
523
+ }
524
+
525
+ // associative sequence | complexity : logarithmic | exception : strong, note A
526
+ std::pair<const_iterator, const_iterator> equal_range( const key_type& x ) const
527
+ {
528
+ return rep_.equal_range( x );
529
+ }
530
+
531
+ private:
532
+ Rep_type rep_;
533
+ };
534
+
535
+ // container | complexity : linear | exception : strong, note A
536
+ template <typename K, typename T, typename Compare, typename Allocator>
537
+ inline bool operator == ( const splay_map<K,T,Compare, Allocator>& lhs, const splay_map<K,T,Compare, Allocator>& rhs )
538
+ {
539
+ return lhs.size() == rhs.size() && std::equal( lhs.begin(), lhs.end(), rhs.begin() );
540
+ }
541
+
542
+ // container | complexity : linear | exception : strong, note A
543
+ template <typename K, typename T, typename Compare, typename Allocator>
544
+ inline bool operator < ( const splay_map<K,T,Compare, Allocator>& lhs, const splay_map<K,T,Compare, Allocator>& rhs )
545
+ {
546
+ return std::lexicographical_compare( lhs.begin(), lhs.end(), rhs.begin(), rhs.end() );
547
+ }
548
+
549
+ // container | complexity : linear | exception : strong, note A
550
+ template <typename K, typename T, typename Compare, typename Allocator>
551
+ inline bool operator != ( const splay_map<K,T,Compare, Allocator>& lhs, const splay_map<K,T,Compare, Allocator>& rhs )
552
+ {
553
+ return !( lhs == rhs );
554
+ }
555
+
556
+ // container | complexity : linear | exception : strong, note A
557
+ template <typename K, typename T, typename Compare, typename Allocator>
558
+ inline bool operator > ( const splay_map<K,T,Compare, Allocator>& lhs, const splay_map<K,T,Compare, Allocator>& rhs )
559
+ {
560
+ return rhs < lhs;
561
+ }
562
+
563
+ // container | complexity : linear | exception : strong, note A
564
+ template <typename K, typename T, typename Compare, typename Allocator>
565
+ inline bool operator <= ( const splay_map<K,T,Compare, Allocator>& lhs, const splay_map<K,T,Compare, Allocator>& rhs )
566
+ {
567
+ return !( rhs < lhs );
568
+ }
569
+
570
+ // container | complexity : linear | exception : strong, note A
571
+ template <typename K, typename T, typename Compare, typename Allocator>
572
+ inline bool operator >= ( const splay_map<K,T,Compare, Allocator>& lhs, const splay_map<K,T,Compare, Allocator>& rhs )
573
+ {
574
+ return !( lhs < rhs );
575
+ }
576
+
577
+ // container | complexity : constant | exception : nothrow
578
+ template <typename K, typename T, typename Compare, typename Allocator>
579
+ inline void swap( splay_map<K,T,Compare, Allocator>& x, splay_map<K,T,Compare, Allocator>& y )
580
+ {
581
+ x.swap( y );
582
+ }
583
+
584
+ // container | complexity : linear | exception : strong, note A
585
+ template <typename K, typename T, typename Compare, typename Allocator>
586
+ inline bool operator == ( const splay_multimap<K,T,Compare, Allocator>& lhs, const splay_multimap<K,T,Compare, Allocator>& rhs )
587
+ {
588
+ return lhs.size() == rhs.size() && std::equal( lhs.begin(), lhs.end(), rhs.begin() );
589
+ }
590
+
591
+ // container | complexity : linear | exception : strong, note A
592
+ template <typename K, typename T, typename Compare, typename Allocator>
593
+ inline bool operator < ( const splay_multimap<K,T,Compare, Allocator>& lhs, const splay_multimap<K,T,Compare, Allocator>& rhs )
594
+ {
595
+ return std::lexicographical_compare( lhs.begin(), lhs.end(), rhs.begin(), rhs.end() );
596
+ }
597
+
598
+ // container | complexity : linear | exception : strong, note A
599
+ template <typename K, typename T, typename Compare, typename Allocator>
600
+ inline bool operator != ( const splay_multimap<K,T,Compare, Allocator>& lhs, const splay_multimap<K,T,Compare, Allocator>& rhs )
601
+ {
602
+ return !( lhs == rhs );
603
+ }
604
+
605
+ // container | complexity : linear | exception : strong, note A
606
+ template <typename K, typename T, typename Compare, typename Allocator>
607
+ inline bool operator > ( const splay_multimap<K,T,Compare, Allocator>& lhs, const splay_multimap<K,T,Compare, Allocator>& rhs )
608
+ {
609
+ return rhs < lhs;
610
+ }
611
+
612
+ // container | complexity : linear | exception : strong, note A
613
+ template <typename K, typename T, typename Compare, typename Allocator>
614
+ inline bool operator <= ( const splay_multimap<K,T,Compare, Allocator>& lhs, const splay_multimap<K,T,Compare, Allocator>& rhs )
615
+ {
616
+ return !( rhs < lhs );
617
+ }
618
+
619
+ // container | complexity : linear | exception : strong, note A
620
+ template <typename K, typename T, typename Compare, typename Allocator>
621
+ inline bool operator >= ( const splay_multimap<K,T,Compare, Allocator>& lhs, const splay_multimap<K,T,Compare, Allocator>& rhs )
622
+ {
623
+ return !( lhs < rhs );
624
+ }
625
+
626
+ // container | complexity : constant | exception : nothrow
627
+ template <typename K, typename T, typename Compare, typename Allocator>
628
+ inline void swap( splay_multimap<K,T,Compare, Allocator>& x, splay_multimap<K,T,Compare, Allocator>& y )
629
+ {
630
+ x.swap( y );
631
+ }
632
+
633
+ } // namespace swiftcore
634
+
635
+ #endif // SPLAY_MAP_H_RMA13022003