- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using V16.0 update 2, and for the moment wish to stick with C++11 (Will look at C++14 in V17 later)
I have a template library that used to work well in the earlier versions of the compiler (C++03), and I am revising them to make use of the C++11 features (in particular variadic templates and use of tuples).
I've got most of the issues worked out except for my templates that manipulate lambda capture objects. Perhaps C++11 "fixed" something (got more strict) with lambda captures. As potential means to work around the issues, I'd like to know if there is a way to determine if a template type is a lambda capture object, and use an enable_if to enable or disable the expansion. something along the line of
is_lambda_capture< T >::value
to return true or false
Jim Dempsey
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jim,
Good question, need to look into and get back to you on this, thanks
Regards,
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think these will work (haven't tried)
template<typename fnT, typename... ArgsT> typename std::enable_if<std::is_function<decltype(fn)>::value && !std::is_object<decltype(fn)>::value>::type my_template_name( fnT fn, ArgsT args ) { ... } template<typename lambdaT, typename... ArgsT> typename std::enable_if<std::is_function<decltype(fn)>::value && std::is_object<decltype(fn)>::value>::type my_template_name( lambdaT fn, ArgsT args ) { ... }
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jim, yes that should work and I am also awaiting a response from the FE team as well and will keep you updated accordingly.
Kittur

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page