|
Boost : |
From: Samuel Krempp (krempp_at_[hidden])
Date: 2003-09-19 11:28:49
It's really a minor issue, but this utility's role is to use a base class as
a member (construct it early, but don't inherit its members).
Wouldn't it be more natural to call it member_from_base (or
base_as_member) ?
this class was motivated by the case of deriving std::basic_stream, like in
boost/test/detail/nullstream.hpp (edited to make shorter lines) :
template<typename Ch, class Tr >
class basic_onullstream :
private boost::base_from_member<basic_nullbuf<Ch, Tr> >
,public ::std::basic_ostream<Ch, Tr>
{
typedef boost::base_from_member<basic_nullbuf<Ch, Tr> > pbase_type;
typedef ::std::basic_ostream<Ch, Tr> base_type;
public:
// Constructor
basic_onullstream()
: pbase_type(), base_type( &this->pbase_type::member ) {}
};
and I must say reading 'base_from_member< .. >' confused me for a few
seconds. (even if I knew from the beginning this stream class was probably
deriving basic_nullbuf as a way to construct it early)
I think 'base_from_member' refers to the writing process, where we transform
a member into a base using this class.
But from the reader point of view, it's the opposite, the intent of the
template class is to transform a base into a member..
-- Samuel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk