Boost logo

Boost :

Subject: Re: [boost] [review] The review of Boost.DoubleEnded starts today: September 21 - September 30
From: Soul Studios (matt_at_[hidden])
Date: 2017-09-28 00:47:55


> I dis-agree, the above pt::pector goes further in this respect and (can)
> reduce(s) it's footprint to 16 bytes (64 bits app.) if required (at the
> cost of a small performance penalty). The use case I referred to above is a
> DAG with adjacency vectors! i.e. every node (many in my use case) has 2
> vectors (in and out), shaving of 8 bytes makes a difference (in improved
> locality and overall memory use).
>
> Why not make this decision a template parameter (as in pt::pector) and be
> done with it?

There's a couple of problems - main one is that two objects from the
same template and with the same T cannot interact (=, ==, swap etc)
easily if the size_type is a template parameter.
The second is that unless the type being declared in template parameter
is being used a -lot-, the reduction in performance cost and memory
usage is very low.

I think a better alternative is to make the default case as generic as
possible, then make it easy for people to modify the code if they have
specific cases that require or benefit from doing so-

I use a template parameter for the skipfield type in colony, but that's
used as much as T so it makes sense.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk