Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,272 of 33,346    |
|    =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to David Barrett-Lennard    |
|    Re: Using type traits with const    |
|    10 May 12 11:56:09    |
      b286c6b0       From: daniel.kruegler@googlemail.com              On 2012-05-10 10:17, David Barrett-Lennard wrote:       > In the following example I want foo() to select the implementation       > based on a trait is_blah which is true for struct X. When foo() is       > passed a const X*, VS2008 and VS2010 select the implementation       > assuming is_blah is false. Is this the expected behaviour?              Sure. Fact is, function template foo deduces for T a type const X and       hands it over to is_blah. This template has no specialization for type       const X (There is a specialization for type X, but this is a different       type). Best is to use typename std::remove_cv |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca