|
Boost : |
From: Daryle Walker (darylew_at_[hidden])
Date: 2005-08-24 08:51:01
On 8/23/05 11:44 AM, "Robert Ramey" <ramey_at_[hidden]> wrote:
> Daryle Walker wrote:
[SNIP]
>> If the latter is the answer, then does:
>>
>> class my_type {
>> friend class ::boost::serialization::access;
>> //...
>> };
>>
>> need a forward (or full) declaration for "access" before it? Or does
>> that only apply to template functions (or is it just template
>> operators)[1]?
>
> If I understand this correctly, the friend declaration could be restricted
> to a couple of functions. But compilers are all over the place as to they
> way they handle this and the above is easy to remember and seems to work
> well. Of course, you're free to use a more elaborate one for your own
> classes.
[TRUNCATE]
No, you misunderstood. I didn't mean to ask what I should be friendly to,
but can I reference "access" without preamble. (I guess you meant that I
could restrict friendliness to some member functions of "access".) Could I
do:
// This is the first line of the file
class my_type {
friend class ::boost::serialization::access;
//...
};
or do I need to do:
// This is the first line of the file
#include <boost/serialization_fwd.hpp> // I'm guessing the name
class my_type {
friend class ::boost::serialization::access;
//...
};
or:
// This is the first line of the file
#include <boost/serialization/access.hpp> // I'm guessing the name
class my_type {
friend class ::boost::serialization::access;
//...
};
? It's actually more of a "rules of C++" question; the section on friends
in the standard isn't too clear here.
-- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk