[Qt-creator] use of std::function in creator

Daniel Teske daniel.teske at digia.com
Thu Aug 15 15:28:39 CEST 2013


On Thursday 15 Aug 2013 14:28:42 Mohamed Fawzi wrote:
> Hi there were already discussions on using C++11, but I would like to use
> something that is a bit older.
> 
> std::function can be very useful to define callbacks, and thus improving
> the api very much. It was already available as part of the technical
> report 1:
> 
> #include <tr1/functional>
> 
> std::tr1::function
> 
> windows released that in 2008, and gcc/clang should work even earlier.
> 
> libstdc++ support is not complete (custom allocator are not supported), but
> if I understand it correctly (you cannot pass custom allocators to the
> function type) it should be fine.
> 
> So with a couple of #ifdef and typedefs one could use it already.
> 
> What do other think?
I'd be in favour of that if we restrict ourselves to the subset of tr1 that 
was later included in C++11. tr1 is widely supported and it's standard c++ 
now. Though I want to see how complicated the code is that works on all 
compilers.

daniel



More information about the Qt-creator mailing list