Created
January 7, 2020 15:56
-
-
Save StarJade-Park/667ab742c03cbfe334de81bb8cc2f5a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// stl의 conditional, conditional_type을 현재 사용중인 컨벤션에 맞춰 이름만 수정한 버전임. | |
#pragma once | |
// Struct template conditional | |
// - type is | |
// - 1. Type_1 for Expression | |
// - 2. Type_2 for assumed !Expression | |
template<bool Expression, class Type_1, class Type_2> | |
struct TConditional | |
{ | |
using type = Type_2; | |
}; | |
// Struct template conditional | |
// - type is | |
// - 1. Type_1 for Expression | |
// - 2. Type_2 for assumed !Expression | |
template<class Type_1, class Type_2> | |
struct TConditional<true, Type_1, Type_2> | |
{ | |
using type = Type_1; | |
}; | |
template<bool Expression, class Type_1, class Type_2> | |
using TConditionalType = typename TConditional<Expression, Type_1, Type_2>::type; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment