Opened 11 years ago

Closed 11 years ago

#5628 closed Bugs (invalid)

filter_iterator - cannot convert from 'char' to 'char &'

Reported by: nen777w@… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc:

Description

MSVS 2008 - error C2440: 'return' : cannot convert from 'char' to 'char &' d:\projects\...\boost\archive\iterators\remove_whitespace.hpp 117

std::ifstream ifs_("test.arc", std::ios_base::in|std::ios_base::binary);
std::ofstream ofs_("test.rez", std::ios_base::out|std::ios_base::binary);

typedef boost::archive::iterators::transform_width<
	boost::archive::iterators::binary_from_base64<
		boost::archive::iterators::remove_whitespace<std::istreambuf_iterator<char> >
	>, 8, 6
> base64_to_bin_t;

std::copy( 
	  base64_to_bin_t(std::istreambuf_iterator<char>(ifs_>> std::noskipws) )
	, base64_to_bin_t(std::istreambuf_iterator<char>() )
	, std::ostreambuf_iterator<char>(ofs_) 
);

Change History (4)

comment:1 by Dave Abrahams, 11 years ago

Component: iteratorserialization
Owner: changed from Dave Abrahams to Robert Ramey

comment:2 by Robert Ramey, 11 years ago

I'm curious about context here. In your test case, the file is opened for binary i/o, BUT we're using the base64 to binary conversion. base64 to binary conversion really only makes sense for text i/o.

Having said that, I don't think it should hit any kind of bug but I can't see where it's coming from. Feel free to add a little more information.

Robert Ramey

comment:3 by Robert Ramey, 11 years ago

I looked into this a little bit.

Note that I made my own istream_iterator.hpp. I don't remember why I did this, but it would well be that the std::istream_iterator manifested this problem. Basically, the standard istream iterator is a single pass iterator so once a character is read, it has to be passed by value as there is no guarantee that the original character address makes any sense. I guess this conflicted with my iterator stack template meta programming implemenation so I had to make my own version. I can only speculate now as it was a long time ago.

Note that my case is different in that I am/was using istream_iterator and you're using istreambuf iterator. (This is the first time I've seen this).

In any case, I think that solves the mystery. Whether or not it addresses your interest I can't say but I can say I don't think it's an issue with the serialization library.

Robert Ramey

comment:4 by Robert Ramey, 11 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.