Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualWaterlimon

Posted 21 June 2013 - 12:34 PM

If you havent already you should also make the methods of objects themselves const:

T object::method(params) const

if they have no side effects on the object (assuming you havent already)

 

EDIT:

In a few circumstances, instead of doing multiple return values using pointer/reference parameters, i use an std::pair (std::tuple for more than 2 members, havent used it).

For example if i need to query some data on some object at coordinates (x,y), i can return something like std::pair(bool exists, objectData data) so i can see if the object exists.

 

For larger objects the objectData would go in a reference or pointer parameter though to avoid copying (assuming the compiler doesnt optimize it out?)


#1Waterlimon

Posted 21 June 2013 - 12:30 PM

If you havent already you should also make the methods of objects themselves const:

T object::method(params) const

if they have no side effects on the object (assuming you havent already)


PARTNERS