ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] naming of
by Samuel Krempp other posts by this author
Sep 19 2003 4:28PM messages near this date
Re: [boost] MPL vector of more than 10 elements | [boost] [ANN] State of Boost.Variant
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved