Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Nov 2016 10:29:57 +0100
From:      Pietro Cerutti <gahr@FreeBSD.org>
To:        =?UTF-8?Q?Otac=C3=ADlio?= <otacilio.neto@bsd.com.br>
Cc:        freebsd-ports@freebsd.org, owner-freebsd-ports@freebsd.org
Subject:   Re: How compile "String inf = static_cast<ostringstream*>(&(ostringstream() << pAct.minArea))->str();"
Message-ID:  <d6f25afe1529486ce23d1d0945e87464@FreeBSD.org>
In-Reply-To: <ebbf89d2-f83a-b03a-95db-05c7d5358aa7@bsd.com.br>
References:  <ebbf89d2-f83a-b03a-95db-05c7d5358aa7@bsd.com.br>

next in thread | previous in thread | raw e-mail | index | archive | help
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@FreeBSD.org

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d6f25afe1529486ce23d1d0945e87464>