added class for compile time optionals
This commit is contained in:
parent
c6cf7bcb37
commit
12ff94e6cc
|
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// Created by Patrick Maschek on 22.01.2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CONST_CONTAINER_COMPILEOPTIONAL_H_
|
||||||
|
#define CONST_CONTAINER_COMPILEOPTIONAL_H_
|
||||||
|
|
||||||
|
namespace cc {
|
||||||
|
template<typename, bool = false>
|
||||||
|
class CompileOptional {};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class CompileOptional<T, true> {
|
||||||
|
private:
|
||||||
|
T _data;
|
||||||
|
public:
|
||||||
|
operator T&() { return _data; }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //UDIFF_COMPILEOPTIONAL_H_
|
||||||
Loading…
Reference in New Issue