%module cpp11_template_parameters_decltype %include %include %include #pragma SWIG nowarn=SWIGWARN_CPP11_DECLTYPE #if 0 // to fix (non-template expression equivalent to template expression further down): %inline %{ #include #include void f(bool c = std::is_constructible>>().begin()->first)>::value) {} %} #endif %inline %{ // Github issue #1590 struct Converter { std::string to_json() const { return std::string(); } }; struct Json { Json(std::string s) {} template < class T, class = decltype(&T::to_json) > Json(const T & t) : Json(t.to_json()) {} // Github issue #1589 // To fix #if !defined(SWIG) // Implicit constructor: map-like objects (std::map, std::unordered_map, etc) template ().begin()->first)>::value, int>::type = 0> Json(const M & m) : Json(object(m.begin(), m.end())) {} #endif }; %} // %template(Json) Json::Json; // not working %template(Json) Json::Json; // workaround %inline %{ // Github issue #1589 template void A() { } %} // %template(A) A<>; // not working %template(A) A; // workaround