Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] compare two archives?
From: James C. Sutherland (James.Sutherland_at_[hidden])
Date: 2010-11-19 15:23:53


On Fri, Nov 19, 2010 at 1:19 PM, James C. Sutherland <
James.Sutherland_at_[hidden]> wrote:

>
> On Fri, Nov 19, 2010 at 12:55 PM, Jeff Flinn <
> TriumphSprint2000_at_[hidden]> wrote:
>
>> James C. Sutherland wrote:
>>
>>> It appears that the operator == is not supported on an archive.
>>>
>>> Is there a way to compare two archives for equality without instantiating
>>> all objects in the archive and looking at equality of the objects?
>>>
>>
>> Wouldn't you just compare the underlying storage of the archived data?
>> Such as the resulting file, or string from a ostringstream.
>>
>> Not sure what your are trying to accomplish.
>>
>>
> Really I just want to compare two archives that I have read in for
> equality.
>
> ifstream file1( tname1.c_str(), std::ios_base::in );
> InputArchive ar1(file1);
> ar1 >> BOOST_SERIALIZATION_NVP(tbl1);
>
> ifstream file2( tname2.c_str(), std::ios_base::in );
> InputArchive ar2(file2);
> ar2 >> BOOST_SERIALIZATION_NVP(tbl2);
>
> So at this point I could compare file1 and file2 or ar1 ar2 or tbl1 and
> tbl2.
> Comparing equality on tbl1 and tbl2 is a bit tedious, so if I could
> directly compare either the files or the archives that would help.
>
> Hopefully that clarifies my question.
>
> James
>

Silly me - apparently ifstream implements an == operator, so that solves my
problem.
Sorry for the false alarm.
James



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