[Development] C++11 decltype magic with a container?

Thiago Macieira thiago.macieira at intel.com
Tue May 21 20:38:41 CEST 2013


On terça-feira, 21 de maio de 2013 20.27.41, Stephen Kelly wrote:
> For a Qt patch, I need to know at compile-time whether std::find can be
> used  with it, ie, whether the value_type of the container can be
> equality-compared.
> 
>  https://codereview.qt-project.org/#change,55735
> 
> I used a decltype, which works for the type itself, but not for the
> container.  I also tried an enable_if, but that doesn't solve the problem
> either.

Let's go back a step.

What are you trying to do?

And what types of a container aren't comparable? All containers require 
comparison in order to implement find() and constFind(); I think the 
associative containers require it in some more situations.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130521/8caa1d12/attachment.sig>


More information about the Development mailing list