I recently watched Stephen Lavavej's excellent channel9 video 'Core C++, 2 of n' in which he described a nice trick to stop template argument deduction: template <typename T> void (T t1, typename std::identity<T>::type t2) { } Browsing the internet for a similar problem, I recently discovered that Peter Dimov already described this trick in 2002 in 'Template function type inference with references' comp.lang.c++.moderated. Boost is more for the libraries, but could it also reserve some space for documenting these template tricks?
On Tue, 18 Feb 2014 04:42:13 -0800, gast128
I recently watched Stephen Lavavej's excellent channel9 video 'Core C++, 2 of n' in which he described a nice trick to stop template argument deduction:
template <typename T> void (T t1, typename std::identity<T>::type t2) { }
Browsing the internet for a similar problem, I recently discovered that Peter Dimov already described this trick in 2002 in 'Template function type inference with references' comp.lang.c++.moderated.
Boost is more for the libraries, but could it also reserve some space for documenting these template tricks?
You may want to bring this on the developers' list; and making the subject a little more informative would probably get your message more reads, something like: "[docs] Add template tricks section." Mostafa
On 18 February 2014 12:42, gast128
I recently watched Stephen Lavavej's excellent channel9 video 'Core C++, 2 of n' in which he described a nice trick to stop template argument deduction:
template <typename T> void (T t1, typename std::identity<T>::type t2) { }
Browsing the internet for a similar problem, I recently discovered that Peter Dimov already described this trick in 2002 in 'Template function type inference with references' comp.lang.c++.moderated.
Boost is more for the libraries, but could it also reserve some space for documenting these template tricks?
There is actually a place for things like that, but it hasn't been updated for years, so it's woefully out of date: http://www.boost.org/community/cpp.html I'm really not sure what to do with it. No seems keen to do this kind thing, and http://isocpp.org/ is tracking C++ development articles, so it might be redundant now anyway.
On 19 Feb 2014 at 8:08, Daniel James wrote:
Boost is more for the libraries, but could it also reserve some space for documenting these template tricks? [snip] I'm really not sure what to do with it. No seems keen to do this kind thing, and http://isocpp.org/ is tracking C++ development articles, so it might be redundant now anyway.
I'm not sure Boost is the right place to document C++ tricks, except via a macro (e.g. BOOST_DISABLE_ARG_DEDUCTION) and some funky header code implementation. Try asking isocpp.org if they're willing to set up a C++ tricks section. I think you'll find them willing, albeit without someone to maintain the section. Niall -- Currently unemployed and looking for work in Ireland. Work Portfolio: http://careers.stackoverflow.com/nialldouglas/
participants (4)
-
Daniel James
-
gast128
-
Mostafa
-
Niall Douglas