Jump to content

  • Log In with Google      Sign In   
  • Create Account

King Mir

Member Since 11 Jun 2006
Offline Last Active Today, 10:15 AM

Posts I've Made

In Topic: Is inheritance evil?

15 April 2016 - 08:13 PM

It is good advice to prefer interfaces over inheritance, but there are uses for inheritance too. Inheritance does get over used, probably because it is often taught too early to new programmers.

 

Personally, I reserve the word "evil" for things that are anti-patterns in all cases. For example, in C++, NULL is evil and can get you into trouble; prefer nullptr in c++11 and later or 0 in C++03 and earlier.


In Topic: [VS2015] Natvis: inspect vector data in custom visualiser

15 April 2016 - 07:52 PM

Your getting into implementation details of std::vector by using _Myfirst. That kind of code isn't portable. Why can't you just call m_vComponents.data()? as in:

<Item Name="Components">m_vComponents.data()</Item>

Of course I'm not familiar with how natvis works, and there are peculiarities related to it.


In Topic: Template-related compiler bug or... ?

15 April 2016 - 12:42 AM

Have you heard about any good progress on concepts?

There's a TS. It will not be in C++17, but possibly C++20.


In Topic: Template-related compiler bug or... ?

12 April 2016 - 10:52 PM

I told you the rule that is applied, but I cannot cite the standard. If you require that level of rigor, I recommend reading the standard yourself.

In Topic: Template-related compiler bug or... ?

12 April 2016 - 10:03 PM

C++ template parameter deduction rules are smart, but there are limits. Essentially you ran into one. Each template function parameter is independently used to deduce the type of T. If different parameters disagree on the type of T, then the template is not considered.

 

C++ template type deduction rules are spelled out in the standard in excruciating detail, and compilers implement it exactly as specified; they cannot be any more or less smart about it because it would change the semantics of the language. While bugs are possible, you would need to be well versed in the C++ standard to differentiate between compiler bugs and C++ limitations.


PARTNERS