Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef RESULT_H
- #define RESULT_H
- #include <array>
- namespace result {
- template <typename valuetype, int size> class Result {
- public:
- Result(std::array<valuetype, size> _Values, int _Id)
- : Id(_Id), Values(_Values){};
- Result(const Result &other) : Id(other.Id), Values(other.Values){};
- Result(Result &&other) noexcept {
- Id = other.Id;
- Values = std::move(other.Values);
- }
- ~Result(){};
- Result &operator=(const Result &other) {
- Result tmp(other);
- *this = std::move(tmp);
- return *this;
- }
- Result &operator=(const Result &&other) noexcept {
- Id = other.Id;
- Values = std::move(other.Values);
- return *this;
- }
- const std::array<valuetype, size> &getValues() const { return Values; };
- std::array<valuetype, size> &setValues() { return Values; };
- const int &getId() const { return Id; };
- int &setId() { return Id; };
- private:
- int Id;
- std::array<valuetype, size> Values;
- };
- }
- #endif // RESULT_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement