#include <xtd/xtd>
using namespace std;
public:
character(
const ustring& name,
const ustring& rank) noexcept : name_(name), rank_(rank) {}
const ustring& name() const noexcept {return name_;}
const ustring& rank() const noexcept {return rank_;}
ustring
to_string() const noexcept {
return name_ +
" (" + rank_ +
")";}
private:
ustring name_;
ustring rank_;
};
int main() {
any value = make_any<int>(42);
value = make_any<ustring>("Star Trek: The Next Generation");
value =
character(
"Jean-Luc Picard",
"Captain");
register_any_stringer<character>([](character value) {return value.to_string();});
}
std::string to_string(const value_t &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: to_string.h:37
@ any
Indicates that all styles except allow_binary_specifier, allow_octal_specifier and allow_hex_specifie...
@ character
Specifies that the text is trimmed to the nearest character.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17