xtd 0.2.0
Loading...
Searching...
No Matches
xtd::comparable< value_t > Struct Template Reference

Definition

template<typename value_t>
struct xtd::comparable< value_t >

Represents the comparable concept.

Definition
template<typename value_t>
Definition comparable.hpp:12
Definition greater_than_comparable.hpp:13
Definition less_than_comparable.hpp:13
Header
#include <xtd/comparable>
Namespace
xtd
Library
xtd.core
Examples
The following code shows how to use xtd::comparable concept
#include <xtd/xtd>
auto get_max(const comparable auto& a, const comparable auto& b) {return a > b ? a : b;}
auto get_min(const comparable auto& a, const comparable auto& b) {return a < b ? a : b;}
auto main() -> int {
println("max = {}", get_max(42, 21));
println("max = {}", get_max(34.5, 62.8));
println("min = {}", get_min(version {1, 2, 4}, version {1, 2, 3}));
println("min = {}", get_min(4_s + 122_ms, 12_s + 234_ms));
}
// This code produces the following output :
//
// max = 42
// max = 62.8
// min = 1.2.3
// min = 00:00:04.1220000
@ a
The A key.
Definition console_key.hpp:88
@ b
The B key.
Definition console_key.hpp:90
void println(FILE *file)
Writes the current line terminator to the file output stream using the specified format information.
Definition println.hpp:14

The documentation for this struct was generated from the following file: