Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-03-16 02:00:43


This also failed to compile for me with VC 7.1.

However it did compile with gcc 3.3, borland 6.64 and comeau.

So its safe to say its a compiler problem. In your case you might
just make all the member public.

Robert Ramey

Robert S. Grimes wrote:
>> Argh! Now if only I can remember the attachments! They are the text
>> (broken) and binary (works) versions. My broken text code in
>> question is presented, in part, below. The compiler complains about
>> the second friend line.
>>
>> -- Code --
>> #include <iostream>
>> #include <ostream>
>> #include <boost/archive/archive_exception.hpp>
>> #include <boost/archive/text_oarchive.hpp>
>>
>> template<class Archive>
>> class rsg_text_oarchive_impl :
>> // don't derive from text_oarchive !!!
>> public boost::archive::text_oarchive_impl<Archive>
>> {
>> typedef rsg_text_oarchive_impl derived_t;
>> #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
>> public:
>> #else
>> friend class
>> boost::archive::basic_text_oarchive<rsg_text_oarchive_impl<Archive>
>> >; friend class
>> boost::archive::basic_text_oprimitive<std::ostream>; friend class
>> boost::archive::save_access; #endif
>> public:
>> rsg_text_oarchive_impl(std::ostream & os, unsigned int flags = 0)
>> : boost::archive::text_oarchive_impl<Archive>(
>> os,
>> flags | boost::archive::no_header // skip default header
>> checking
>> )
>> {
>> // use our own header checking
>> if (0 == (flags & boost::archive::no_header)){
>> os << "<!-- RSG Text Archive -->" << std::endl;
>> this->boost::archive::basic_text_oarchive<Archive>::init();
>> }
>> }
>> };
>> -- end Code - more follows here...
>>
>>
>>> -----Original Message-----
>>> Subject: [serialization] Problem deriving from text_oarchive_impl
>>>
>>>
>>> Hi,
>>>
>>> I'm starting to get the hang of this as I slog through, but it's
>>> still a bit rough! I'm able to derive a new archive from
>>> binary_oarchive_impl, but for some reason, I can't do the same
>>> with text_oarchive_impl. Specifically, I get the following error
>>> (from MS Visual C++ 8.0, using Boost 1.33.1):
>>>
>>> 1>..\rsg_text_oarchive.hpp(24) : error C2649:
>>> 'basic_text_oprimitive<class std::basic_ostream<char,struct
>>> std::char_traits<char> > >' : is not a 'class'
>>> 1> ..\rsg_text_oarchive.hpp(40) : see reference to class
>>> template instantiation 'rsg_text_oarchive_impl<Archive>' being
>>> compiled
>>>
>>> The similar line in the binary archive works fine. Attached are
>>> the two derived archives in question. All I'm trying to do (at
>>> this point) is add a short header in the constructor; next, I'll
>>> want to add a footer in the destructor.
>>>
>>> Thanks!
>>> -Bob
>>
>
>
>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net