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

Otacílio otacilio.neto at bsd.com.br
Mon Nov 14 14:09:41 UTC 2016


Em 14/11/2016 06:29, Pietro Cerutti escreveu:
> 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) :)
>
I'm using your suggestion and it works fine. Thanks a lot!


[]'s

-Otacilio



More information about the freebsd-ports mailing list