- string_view[meta header]
- std[meta namespace]
- function template[meta id-type]
- cpp17[meta cpp]
namespace std {
template <class CharT, class Traits>
constexpr bool operator<(basic_string_view<CharT, Traits> x,
basic_string_view<CharT, Traits> y) noexcept;
}basic_string_viewオブジェクトにおいて、左辺が右辺より小さいかの判定を行う。
return x.compare(y) < 0;- compare[link compare.md]
#include <iostream>
#include <string_view>
int main()
{
std::string_view a = "aaa";
std::string_view b = "bbb";
if (a < b) {
std::cout << "less" << std::endl;
}
else {
std::cout << "greater equal" << std::endl;
}
}less
- C++17
- Clang, C++17 mode: 4.0
- GCC, C++17 mode: 7.1
- ICC: ??
- Visual C++: ??