
On 13 Jun 2016, at 16:29, Larry Evans
wrote: On 06/13/2016 06:31 AM, Thijs van den Berg wrote: Hi Giuseppe,
I'm still hoping to see a strongly typed C++ heterogeneous container that doesn't enforce base classes on elements,
By "base class on elements" do you mean something like the multiple inheritance method as described in mitchnull's reply here:
http://stackoverflow.com/questions/4041447/how-is-stdtuple-implemented#answe...
IOW, that method muliply inherits from
TupleLeaf, for I=0...sizeof...(T)-1
for:
template
class PseudoTuple ; If that's what you mean, then could you explain the disadvantage of this method vs some other method?
Hi Larry, No not like that. I would think something different like this would add something to the table: http://lists.boost.org/Archives/boost/2015/05/221948.php Which basicly splits a container into a set of single type subcontainers. The benefits are: * you don't enforce special properties on the elements -like having a shared base class- (I'm not saying that Giuseppe's does, but libraries shouldn't dictate what user code should look like if possible) * the compiler can know the type of elements and hence It can use all sorts of compile time optimization. Eg I did and experiment with a set of shapes {square, circle} and operations like {move,rotate} on them. Rotating a circle was considered pointless and it's easy to eliminate that complete form the compiled code. * there is no run time overhead of indirection, or type inspection.