#pragma once #include #include namespace DB { template struct CopyableAtomic { CopyableAtomic(const CopyableAtomic & other) : value(other.value.load()) {} template U> explicit CopyableAtomic(U && value_) : value(std::forward(value_)) {} CopyableAtomic & operator=(const CopyableAtomic & other) { value = other.value.load(); return *this; } template U> CopyableAtomic & operator=(U && value_) { value = std::forward(value_); return *this; } explicit operator T() const { return value; } const T & getValue() const { return value; } std::atomic value; }; }