How compile "String inf = static_cast<ostringstream*>(&(ostringstream() << pAct.minArea))->str();"

Pietro Cerutti gahr at FreeBSD.org
Mon Nov 14 09:30:07 UTC 2016


On 2016-11-09 02:37, Otacílio wrote:
> I'm trying create a patch to OpenCV 3.1 runs on FreeBSD but clang
> don't compiles lines like this:
> 
> String inf = static_cast<ostringstream*>(&(ostringstream() <<
> pAct.minArea))->str();

There's nothing wrong with this code, provided that:

* <sstream> is included
* ostringstream is actually std::ostringstream
* pAct.minArea defines operator<< to std::ostringstream or one of its 
base classes

What's the error you're getting?

That being said, I'd switch to using c++11 and String inf = 
std::to_string(pAct.minArea) :)

-- 
Pietro Cerutti
gahr at FreeBSD.org

PGP Public Key:
http://gahr.ch/pgp


More information about the freebsd-ports mailing list