Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


rozz666

Member Since 27 May 2007
Offline Last Active Aug 29 2015 10:14 AM

Posts I've Made

In Topic: Casting Problem

15 May 2015 - 05:22 AM


It's kind of annoying to have to cast everything, etc...

 

If you need to cast, then you should review your design. The point of an abstraction not to depend on concrete types.

E.g. your GraphicsFactory::init accepts and interface, but inside you assume it's a specific class. What if I derive another class from IInitiationSettings? init will probably crash, even though init declaration told me I can pass anything that's an IInitiationSettings.

 

Of course, IInitiationSettings should be a data object, but this has already been address in other posts.


In Topic: std::map iterator increment issue

17 November 2014 - 01:12 PM


That means that pointers are not guaranteed to satisfy the "strict weak ordering" requirement for keys in a map, which in turn probably results in undefined behavior.

 

While this is true for operator<, std::less for pointer guarantees correct ordering (source: http://en.cppreference.com/w/cpp/utility/functional/less).


In Topic: Using old array or stl

19 August 2014 - 01:52 PM

Yes, I agree with fastcall22.


In Topic: Reference initialization required.

15 April 2014 - 01:05 PM

 

In Python, references are mutable and their labels (referers)are changed to refer to other referents(objects) by using an = operation.

a=20
b=a
b=30 # Changing object refering-to (referent 30)
del a # Who cares?! b is referring to another object now. Object 20 is garbage collected.  
print b

Output:

30

 

Python reference are C++ pointers (they are also garbage collected, of course).


In Topic: "Vector" of types? (compile time template)

23 March 2014 - 03:00 PM

Have a look at Boost.MPL: http://www.boost.org/doc/libs/1_55_0/libs/mpl/doc/refmanual.html

It provides among other things containers and algorithms for types.


PARTNERS