Opened 11 years ago
Closed 11 years ago
#5628 closed Bugs (invalid)
filter_iterator - cannot convert from 'char' to 'char &'
| Reported by: | 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 , 11 years ago
| Component: | iterator → serialization |
|---|---|
| Owner: | changed from to |
comment:2 by , 11 years ago
comment:3 by , 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 , 11 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |

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