[cfe-dev] Determining whether Container<T>()==Container<T>() can compile?

Stephen Kelly steveire at gmail.com
Fri May 24 01:41:09 PDT 2013


Hi there,

Code such as 

  std::vector<A> veca, vecb;
  veca == vecb;

can only compile if A()==A() can compile, if you'll forgive me taking some 
descriptive shortcuts.

I tried writing a template to determine if a type can be equality-compared 
for the purpose of type-erasure:

 http://thread.gmane.org/gmane.comp.lib.qt.devel/11120

Adding auto and trailing return type seems to be helpful:

 http://thread.gmane.org/gmane.comp.lib.qt.devel/11120/focus=11157

Would the suggestion from Olivier Goffart be something that could be applied 
to libcxx to make it possible to write such a template for its stl container 
implementations?

Does anyone else have any other ideas for something that would work with 
todays stl implementations?

Thanks,

Steve.





More information about the cfe-dev mailing list