4#ifndef DASMIG_CORE_SEX_HPP
5#define DASMIG_CORE_SEX_HPP
17#ifndef DASMIG_SEX_DEFINED
18#define DASMIG_SEX_DEFINED
24enum class sex : std::uint8_t
40[[nodiscard]]
constexpr std::string_view
sex_name(
sex s)
noexcept
44 case sex::male:
return "male";
45 case sex::female:
return "female";
56[[nodiscard]]
constexpr std::optional<sex>
parse_sex(std::string_view text)
noexcept
58 if (text ==
"male")
return sex::male;
59 if (text ==
"female")
return sex::female;
constexpr std::optional< sex > parse_sex(std::string_view text) noexcept
Reads the name written by sex_name().
constexpr std::string_view sex_name(sex s) noexcept
The lower-case name of a sex, as written in data files and JSON.