Cogs.Core
UniqueValue.h
1#pragma once
2
3namespace Cogs {
4
31 template<typename T>
32 struct UniqueValue {
33 UniqueValue() = default;
34 UniqueValue(const T& value) : value(value) {}
35 UniqueValue(const UniqueValue&) = delete;
36 UniqueValue(UniqueValue&& other) noexcept : value(other.value) { other.value = T(0); }
37
38 UniqueValue& operator=(const UniqueValue&) = delete;
39 UniqueValue& operator=(UniqueValue&& other) noexcept { value = other.value; other.value = T(0); return *this; }
40
41 T value = T(0);
42 };
43
44}
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
A value that is cleared (zero-initialised) when it is moved from.
Definition: UniqueValue.h:32