[OT] C++ tips for a D programmer

Simon s.d.hammett at gmail.com
Wed Aug 31 10:36:19 PDT 2011


On 31/08/2011 13:41, Alex Rønne Petersen wrote:
>
> Whatever you do, avoid multiple inheritance like the plague. It will
> bite you, especially if you use pointers.
>
> - Alex

I that's a little overly simplistic:

Avoid multiple inheritance from classes with actual data members;
do use multiple inheritance as a stand in for template mixins.

Also as others have mentioned, do use boost.
It's a massive time saver, though there's so much in it, it can be a bit 
hard to find the bit which does what you want.

Things to check out specifically:

format:
	http://www.boost.org/doc/libs/1_47_0/libs/format/index.html
foreach:
	http://www.boost.org/doc/libs/1_47_0/doc/html/foreach.html
property tree:
	http://www.boost.org/doc/libs/1_47_0/doc/html/property_tree.html
	(it's got a small and useful xml library built in)
signals:
	http://www.boost.org/doc/libs/1_47_0/doc/html/signals.html
smart_ptr:
	http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/smart_ptr.htm

static_assert:
	http://www.boost.org/doc/libs/1_47_0/doc/html/boost_staticassert.html

string_algorithms:
	http://www.boost.org/doc/libs/1_47_0/doc/html/string_algo.html

Have a poke through those and you'll find they cover a big chunk of D's 
real time savers.

And if you need to do some template programming:

mpl:

	http://www.boost.org/doc/libs/1_47_0/libs/mpl/doc/index.html

-- 
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk


More information about the Digitalmars-d mailing list