Cogs.Foundation
Loading...
Searching...
No Matches
UniqueValue.h
Go to the documentation of this file.
1#pragma once
2
3namespace Cogs {
4
12 template<typename T>
13 struct UniqueValue {
14 UniqueValue() = default;
16 UniqueValue(const UniqueValue&) = delete;
17 UniqueValue(UniqueValue&& other) noexcept : value(other.value) { other.value = T(0); }
18
20 UniqueValue& operator=(UniqueValue&& other) noexcept { value = other.value; other.value = T(0); return *this; }
21
22 T value = T(0);
23 };
24
25}
Main Cogs namespace.
Definition: MortonCode.h:5
A value that is cleared when it is moved from.
Definition: UniqueValue.h:13
UniqueValue()=default
UniqueValue & operator=(const UniqueValue &)=delete
UniqueValue(const UniqueValue &)=delete
T value
Definition: UniqueValue.h:22
UniqueValue & operator=(UniqueValue &&other) noexcept
Definition: UniqueValue.h:20
UniqueValue(const T &value)
Definition: UniqueValue.h:15
UniqueValue(UniqueValue &&other) noexcept
Definition: UniqueValue.h:17