Hi I've a mimeType in ORTB, but couldn't pass compile, is there anyway to iterate banner.mimes and cast it to string?
cerr << "banner.mimes:" << banner.mimes.empty() << endl;
if (!banner.mimes.empty()){
for(auto & mime : banner.mimes) {
cerr << "banner.mime:" << mime << endl;
std::vector<ORTB::MimeType> mimes;
mimes.push_back(mime.toString());
ctx.br->segments.add("mimes", mimes);
}
}
it says: error: cannot bind âstd::basic_ostreamâ lvalue to âstd::basic_ostream&&â /usr/include/c++/4.6/ostream:581:5: error: initializing argument 1 of âstd::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char, _Traits = std::char_traits, _Tp = ORTB::MimeType]â
if
is completely redundant. 2. The error isn’t from the iteration, it’s from thecerr << …
line. We need more context to be able to tell what’s causing this. But the definition of the<<
operator forMimeType
seems to be wrong because somewhere the stream is being converted to aconst&
. – Konrad Rudolph