32 lines
566 B
C++
32 lines
566 B
C++
//
|
|
// Created by Patrick Maschek on 22.01.2024.
|
|
//
|
|
|
|
#ifndef CONST_CONTAINER_COMPILEOPTIONAL_H_
|
|
#define CONST_CONTAINER_COMPILEOPTIONAL_H_
|
|
|
|
#include <type_traits>
|
|
|
|
namespace cc {
|
|
template<typename, bool Cond = false>
|
|
class CompileOptional {};
|
|
|
|
template<typename T>
|
|
class CompileOptional<T, false> {
|
|
public:
|
|
using defined = std::false_type;
|
|
};
|
|
|
|
template<typename T>
|
|
class CompileOptional<T, true> {
|
|
public:
|
|
using defined = std::true_type;
|
|
operator T&() { return _data; }
|
|
private:
|
|
T _data;
|
|
};
|
|
|
|
}
|
|
|
|
#endif //CONST_CONTAINER_COMPILEOPTIONAL_H_
|