added defined to CompileOptional
This commit is contained in:
parent
8170507158
commit
e8fac3a44d
|
|
@ -5,17 +5,27 @@
|
|||
#ifndef CONST_CONTAINER_COMPILEOPTIONAL_H_
|
||||
#define CONST_CONTAINER_COMPILEOPTIONAL_H_
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace cc {
|
||||
template<typename, bool = false>
|
||||
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;
|
||||
public:
|
||||
operator T&() { return _data; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //UDIFF_COMPILEOPTIONAL_H_
|
||||
#endif //CONST_CONTAINER_COMPILEOPTIONAL_H_
|
||||
|
|
|
|||
Loading…
Reference in New Issue