2013-10-17から1日間の記事一覧

C++14 の Generic lambdas で SFINAE

C++

まぁ Generic lambdas だと多重定義できないのでほとんど意味は無いのですが。 [ソース] #include <iostream> #include <type_traits> #include <string> int main(){ auto plus = [](auto a, auto b) ->decltype(a + b){ return a + b; }; std::cout << plus(1, 2) << std::endl; std::cout </string></type_traits></iostream>…