Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2005-06-16 04:43:08


Hello,

I'm not really sure but isn't there a friend declaration missing in the
fixed_mapping class?

Given the following code:

template< ... >
class fixed_mapping
{
     typedef std::pair<Key,Value> elem_type;
     ...
     struct p1 : public std::binary_function<elem_type,Key,bool>
     {
         bool operator()( elem_type const& x, Key const& y ) const
         { return Compare()( x.first, y ); }
     };
     ...
};

doesn't this require p1 to be a friend of fixed mapping to be able to
access elem_type in it's operator()?

This would then give:

template< ... >
class fixed_mapping
{
     typedef std::pair<Key,Value> elem_type;
     ...
     struct p1; friend struct p1;
     ...
     struct p1 : public std::binary_function<elem_type,Key,bool>
     {
         bool operator()( elem_type const& x, Key const& y ) const
         { return Compare()( x.first, y ); }
     };
     ...
};

Markus


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