#include <format>
#include <gw/inplace_string.hpp>
#include <gw/strong_type.hpp>
#include <iostream>
#include <stdexcept>
#include <type_traits>
static constexpr auto k_string_size = 20U;
static_assert(!std::is_same_v<name_t, address_t>);
void print_name(const name_t& name) { std::cout << std::format("{}\n", name); }
void print_address(const address_t& address) { std::cout << std::format("{}\n", address); }
auto main() -> int {
try {
constexpr auto name = name_t{"John Doe"};
constexpr auto address = address_t{"123 Main St."};
print_name(name);
print_address(address);
} catch (const std::length_error& ex) {
std::cerr << ex.what() << '\n';
}
}
Strong type wrapper.
Definition strong_type.hpp:46