Nice use of tricks of sizeof, mentioned in Davide Di Gennaro's book:
Advanced C++ Metaprogramming with C++14 features enabled.
2 things to be noticed:
- decltype won't evaluate it's content. Which it can't take lambda expression as an argument.
- Lambdas can't be passed as parameters to constexpr functions. Ref: constexpr lambda functions
The technique is made use of
declval (std::add_rvalue_reference<T>::type) / decltype / sizeof / template lambda / SFINAE
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.