std::default_order

From cppreference.com
< cpp‎ | utility‎ | functional
 
 
 
Function objects
Function wrappers
(C++11)
(C++11)
(C++17)
Bind
(C++11)
(C++11)
(C++11)
Reference wrappers
(C++11)(C++11)
Default ordering
default_order
(C++17)


Operator wrappers
Negators
(deprecated)
(deprecated)

(deprecated)
(deprecated)
Searchers
Old binders and adaptors
(until C++17)
(until C++17)
(until C++17)
(until C++17)
(until C++17)(until C++17)(until C++17)(until C++17)
(until C++17)(until C++17)
(until C++17)(until C++17)

(until C++17)
(until C++17)(until C++17)(until C++17)(until C++17)
 
Defined in header <functional>
template< class T >
class default_order;
(since C++17)

std::default_order is a type trait that specifies the default strict weak ordering for its type argument T. The associative containers std::map, std::set, std::multimap, std::multiset, as well as the adaptor std::priority_queue uses std::default_order_t<T> by default as their Compare function object.

By default, this trait returns std::less<T>. Users may specialize this trait for user-defined types to provide a different default strict weak ordering.

Contents

[edit] Member types

Name Definition
type std::less<T>; may be specialized for user-defined types.

[edit] Helper types

template< class T >
using default_order_t = typename default_order<T>::type;
(since C++17)

[edit] Notes

std::default_order is intended to be used with types such as std::complex, which have an ordering for their representation, but not for their semantics.

[edit] See also

collection of key-value pairs, sorted by keys, keys are unique
(class template)
collection of key-value pairs, sorted by keys
(class template)
collection of unique keys, sorted by keys
(class template)
collection of keys, sorted by keys
(class template)
adapts a container to provide priority queue
(class template)