Using small vector.

This commit is contained in:
Pcornat 2024-03-04 17:24:17 +01:00
parent bde031f393
commit a693da20bf
Signed by: Pcornat
GPG key ID: E0326CC678A00BDD
2 changed files with 7 additions and 9 deletions

View file

@ -45,8 +45,9 @@ namespace character {
class BillyObjects final {
public:
static constexpr std::size_t max_num_obj{ 3 };
using billyObject = std::variant<weapons, equipments, tools>;
using container = ankerl::svector<billyObject, 3>;
using container = ankerl::svector<billyObject, max_num_obj>;
static constexpr std::string_view sword{ "Sword" };
static constexpr std::string_view lance{ "Lance" };
@ -69,12 +70,9 @@ namespace character {
void pop_object(CharacterSheet &sheet) noexcept;
[[nodiscard]] const container &get_objects() const noexcept { return objects; }
// void insert_weapon(weapons weapon, CharacterSheet &sheet) noexcept;
private:
container objects;
std::plus<std::uint32_t> plus;
std::minus<std::uint32_t> minus;