Last active
February 17, 2019 22:40
-
-
Save FuZer/2d7dc665572f1238737f9e5fa70d99df to your computer and use it in GitHub Desktop.
A<0> 제거, 재귀적 접근 다이렉트로 접근하게 변경, 잘못된 접근 컴파일 에러
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
| #include <iostream> | |
| template <std::size_t Idx> | |
| struct A { | |
| constexpr static std::size_t idx = Idx; | |
| template <std::size_t Target> | |
| using get = std::enable_if_t<(Idx > Target), std::conditional_t<Target == 0, A<Idx>, A<Idx-Target>>>; | |
| }; | |
| int main() { | |
| std::cout << A<1000>::get<100>::idx << std::endl; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment