#include <xtd/xtd>
struct superhero {
string name;
string alter_ego;
auto to_string() const noexcept -> string {return string::format("{}/{}", name, alter_ego);}
auto operator<=>(const superhero& other) const noexcept = default;
};
struct supervillain : istringable<supervillain>, icomparable<supervillain> {
supervillain() = default;
supervillain(string name, string alter_ego) : name {name}, alter_ego {alter_ego} {}
string alter_ego;
auto to_string() const noexcept ->
string override {
return string::format(
"{}/{}", name, alter_ego);}
auto compare_to(const supervillain& other) const noexcept -> int override {
return result != 0 ? result : alter_ego.compare_to(
other.alter_ego);
}
};
auto main() -> int {
auto numbers = array {10, 6, 5, 7, 8, 2, 9, 3, 1, 4};
numbers.sort();
auto fruits = array<string> {"Orange", "Apple", "Banana", "Strawberry", "Watermelon", "Pear", "Coconut", "Kiwi", "Plum", "Grapes"};
fruits.sort();
auto superheroes = array<superhero> {
{.name = "Barry Allen", .alter_ego = "The Flash"},
{.name = "Oliver Queen", .alter_ego = "Arrow"},
{.name = "Hal Jordan", .alter_ego = "Green Lantern"},
{.name = "Bruce Wayne", .alter_ego = "Batman"},
{.name = "Clark Kent", .alter_ego = "Superman"},
{.name = "Jefferson Pierce", .alter_ego = "Black Lightning"},
{.name = "Kara Zor-El", .alter_ego = "Supergirl"},
};
superheroes.sort();
println(
"superheroes = {}", superheroes);
auto supervillains = array<supervillain> {
{"Pamela Isley", "Poison Ivy"},
{"George Harkness", "Captain Boomerang"},
{"El-Kal", "Bizarro"},
{"Winslow Schott", "Toyman"},
{"Theo Adam", "Black Adam"},
{"Joar Mahkent", "Icicle"},
{"Caitlin Snow", "Killer Frost"}
};
supervillains.sort();
println(
"supervillains = {}", supervillains);
}
auto name() noexcept -> xtd::string
Gets the thread name of the current thread.
@ other
The operating system is other.
Definition platform_id.hpp:60
auto to_string() const noexcept -> xtd::string override
Returns the string representation of this xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:354
auto println(FILE *file) -> void
Writes the current line terminator to the file output stream using the specified format information.
Definition println.hpp:15