Cogs.Core
UniqueValue.h
1#pragma once
2
3namespace Cogs {
4
12 template<typename T>
13 struct UniqueValue {
14 UniqueValue() = default;
15 UniqueValue(const T& value) : value(value) {}
16 UniqueValue(const UniqueValue&) = delete;
17 UniqueValue(UniqueValue&& other) noexcept : value(other.value) { other.value = T(0); }
18
19 UniqueValue& operator=(const UniqueValue&) = delete;
20 UniqueValue& operator=(UniqueValue&& other) noexcept { value = other.value; other.value = T(0); return *this; }
21
22 T value = T(0);
23 };
24
25}
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
A value that is cleared when it is moved from.
Definition: UniqueValue.h:13