- deque[meta header]
- std[meta namespace]
- function template[meta id-type]
namespace std {
// operator<=>により、以下の演算子が使用可能になる (C++20)
template <class T, class Allocator>
bool
operator<(const deque<T, Allocator>& x,
const deque<T, Allocator>& y); // (1) C++03
template <class T, class Allocator>
constexpr bool
operator<(const deque<T, Allocator>& x,
const deque<T, Allocator>& y); // (1) C++26
}dequeにおいて、左辺が右辺より小さいかの判定を行う。
型Tが<比較可能であること。その<が全順序関係を持っていること。
lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());- lexicographical_compare[link /reference/algorithm/lexicographical_compare.md]
- begin()[link begin.md]
- end()[link end.md]
size() に対して線形時間。
#include <iostream>
#include <deque>
int main ()
{
std::deque<int> c1 = {1, 2, 3};
std::deque<int> c2 = {4, 5, 6};
std::cout << std::boolalpha;
std::cout << (c1 < c2) << std::endl;
}true
- P1614R2 The Mothership has Landed
- C++20での三方比較演算子の追加と、関連する演算子の自動導出
- P3372R3 constexpr containers and adaptors