Add sort policy to intrusive lazy list trait.
authorMike Krinkin <krinkin.m.u@gmail.com>
Sat, 28 Mar 2015 06:36:41 +0000 (09:36 +0300)
committerMike Krinkin <krinkin.m.u@gmail.com>
Sat, 28 Mar 2015 06:36:41 +0000 (09:36 +0300)
Boolean sort flag indicates whether list is ordered or unordered.
Default value is false, so, by default, intrusive lazy list is
unordered.

cds/intrusive/details/lazy_list_base.h

index bddbd51056161d3cd6cc1ca88a1c999913f0dae2..bc6ff520c5820ce081865b4498d09001ae8de697 100644 (file)
@@ -215,6 +215,13 @@ namespace cds { namespace intrusive {
             */
             typedef opt::none                       equal_to;
 
+            /// Specifies list ordering policy
+            /**
+                If \p sort is \p true, than list maintains items in sorted order, otherwise items are unordered. Default is \p true.
+                Note that if \p sort is \p false, than lookup operations scan entire list.
+            */
+            static const bool sort = true;
+
             /// Back-off strategy
             typedef cds::backoff::Default           back_off;
 
@@ -254,6 +261,7 @@ namespace cds { namespace intrusive {
             - \p opt::less - specifies binary predicate used for key comparison. Default is \p std::less<T>.
             - \p opt::equal_to - specifies binary functor for comparing keys for equality. If \p equal_to is not specified, \p compare is
                 used, \p compare is not specified, \p less is used.
+            - \p opt::sort - specifies ordering policy. Default value is \p true.
             - \p opt::back_off - back-off strategy used. If the option is not specified, the \p cds::backoff::Default is used.
             - \p opt::disposer - the functor used for dispose removed items. Default is \p opt::v::empty_disposer. Due the nature
                 of GC schema the disposer may be called asynchronously.