Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-04-29 13:26:28

Sorry about the HTML in that other message. This is a duplicate.
From: Dave Abrahams <abrahams_at_[hidden]>
Reply-To: boost_at_[hidden]
Date: Sat, 29 Apr 2000 10:44:52 -0500
To: <boost_at_[hidden]>
Subject: Re: [boost] Empty base optimization and operators.hpp

It is clear to me that we must avoid inducing multiple inheritance for the
common uses of operators.hpp. Many common compilers will use the empty base
optimization for single inheritance, but as we've seen the problem is a bit
tougher when MI is involved. The only obvious solution, IMO, is to do
something which allows the following (which will cause a chain of single

template <class T,
        class V,
        class D = std::iterator_traits<char*>::difference_type,
        class P = V*,
        class R = V&>
struct bidirectional_iterator_helper :
        std::iterator<std::bidirectional_iterator_tag, V, D>
{ };

I think one upshot of this technique, though, is that the use of partial
specialization for 2-type versions of some operator templates, such as
equality_comparable, must finally die (or at least lose backward
compatibility) in favor of the versions with "2" at the end of the name. I
don't see any way around this. If you do, please speak up!

The reason is that the common, single-argument usage needs to be augmented
with a 2nd type argument which allows the base-class chaining shown above
(and defaults to some empty class). Thus, we can no longer use it for the
optional 2nd type for binary operations.


Boost list run by bdawes at, gregod at, cpdaniel at, john at