-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRucksack.h
58 lines (46 loc) · 1.74 KB
/
Rucksack.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// Created by Aidan Nagorcka-Smith on 30/12/2022.
//
#ifndef RUCKSACK_H
#define RUCKSACK_H
#include <set>
#include <vector>
#include "Item.h"
namespace AdventOfCode::DayThree {
class Rucksack {
public:
class Compartment {
public:
Compartment(Compartment &&other) noexcept;
Compartment(const Compartment &other) noexcept;
explicit Compartment(std::vector<Item> &&items);
[[nodiscard]] auto contains(const Item &item) const -> bool;
[[nodiscard]] auto items() const -> const std::vector<Item> &;
private:
std::vector<Item> items_;
};
class Builder {
public:
auto withCompartmentOneContent(const Item &item) -> Builder &;
auto withCompartmentOneContent(Item &&item) -> Builder &;
auto withCompartmentTwoContent(const Item &item) -> Builder &;
auto withCompartmentTwoContent(Item &&item) -> Builder &;
auto build() -> Rucksack;
auto reset() -> void;
private:
std::vector<Item> compartmentOneContent_;
std::vector<Item> compartmentTwoContent_;
};
Rucksack(const Rucksack &other) noexcept;
Rucksack(Rucksack &&other) noexcept;
Rucksack(Compartment &&compartmentOne, Compartment &&compartmentTwo) noexcept;
[[nodiscard]] auto compartmentOne() const -> const Compartment &;
[[nodiscard]] auto compartmentTwo() const -> const Compartment &;
[[nodiscard]] auto allUniqueItems() const -> std::set<Item>;
static auto builder() -> Builder;
private:
Compartment compartmentOne_;
Compartment compartmentTwo_;
};
} // AdventOfCode::DayThree
#endif // RUCKSACK_H