added class for compile time optionals

This commit is contained in:
cyborg1811m 2024-01-22 22:42:32 +01:00
parent c6cf7bcb37
commit 12ff94e6cc
1 changed files with 21 additions and 0 deletions

21
include/CompileOptional.h Normal file
View File

@ -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_