Re: How compile "String inf = static_cast<ostringstream*>(&(ostringstream() << pAct.minArea))->str();"
On 2016-11-14 14:39, Otacílio wrote: 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() << pAct.minArea))->str(); There's nothing wrong with this code, provided that: * 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) :) Hi This code is in /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp line 76 . I'm using C++11. The full compiler error message is this: [ 95%] Built target example_image_sequence --- samples/cpp/CMakeFiles/example_select3dobj.dir/all --- /usr/bin/make -f samples/cpp/CMakeFiles/example_select3dobj.dir/build.make samples/cpp/CMakeFiles/example_select3dobj.dir/depend --- samples/cpp/CMakeFiles/example_select3dobj.dir/depend --- cd /usr/ports/graphics/opencv3/work/opencv-3.1.0 && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /usr/ports/graphics/opencv3/work/opencv-3.1.0 /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp /usr/ports/graphics/opencv3/work/opencv-3.1.0 /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/CMakeFiles/example_select3dobj.dir/DependInfo.cmake --color= --- samples/cpp/CMakeFiles/example_detect_mser.dir/all --- /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:76:46: error: cannot take the address of an rvalue of type 'std::__1::basic_ostringstream ' String inf = static_cast (&(ostringstream() << pAct.minArea))->str(); ^ ~~~ oh, of course :) you could force runtime polymorphism by turning the temporary into a reference, like this: String inf = static_cast(ostringstream() << pAct.minArea).str() -- Pietro Cerutti g...@freebsd.org PGP Public Key: http://gahr.ch/pgp ___ freebsd-ports@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"
Re: How compile "String inf = static_cast<ostringstream*>(&(ostringstream() << pAct.minArea))->str();"
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() << pAct.minArea))->str(); There's nothing wrong with this code, provided that: * 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 ___ freebsd-ports@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"
Re: How compile "String inf = static_cast<ostringstream*>(&(ostringstream() << pAct.minArea))->str();"
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() << pAct.minArea))->str(); There's nothing wrong with this code, provided that: * 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) :) Hi This code is in /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp line 76 . I'm using C++11. The full compiler error message is this: [ 95%] Built target example_image_sequence --- samples/cpp/CMakeFiles/example_select3dobj.dir/all --- /usr/bin/make -f samples/cpp/CMakeFiles/example_select3dobj.dir/build.make samples/cpp/CMakeFiles/example_select3dobj.dir/depend --- samples/cpp/CMakeFiles/example_select3dobj.dir/depend --- cd /usr/ports/graphics/opencv3/work/opencv-3.1.0 && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /usr/ports/graphics/opencv3/work/opencv-3.1.0 /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp /usr/ports/graphics/opencv3/work/opencv-3.1.0 /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/CMakeFiles/example_select3dobj.dir/DependInfo.cmake --color= --- samples/cpp/CMakeFiles/example_detect_mser.dir/all --- /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:76:46: error: cannot take the address of an rvalue of type 'std::__1::basic_ostringstream ' String inf = static_cast (&(ostringstream() << pAct.minArea))->str(); ^ ~~~ /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:77:46: error: cannot take the address of an rvalue of type 'std::__1::basic_ostringstream ' String sup = static_cast (&(ostringstream() << pAct.maxArea))->str(); ^ ~~~ /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:80:39: error: cannot take the address of an rvalue of type 'std::__1::basic_ostringstream ' inf = static_cast (&(ostringstream() << pAct.delta))->str(); ^ ~ /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:82:39: error: cannot take the address of an rvalue of type 'std::__1::basic_ostringstream ' inf = static_cast (&(ostringstream() << pAct.maxVariation))->str(); ^ /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:84:39: error: cannot take the address of an rvalue of type 'std::__1::basic_ostringstream ' inf = static_cast (&(ostringstream() << (int)pAct.minDiversity))->str(); ^ ~ /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:86:39: error: cannot take the address of an rvalue of type 'std::__1::basic_ostringstream ' inf = static_cast (&(ostringstream() << (int)pAct.pass2Only))->str(); ^ ~~ /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:88:39: error: cannot take the address of an rvalue of type 'std::__1::basic_ostringstream ' inf = static_cast (&(ostringstream() << (int)pAct.maxEvolution))->str(); ^ ~ /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:90:39: error: cannot take the address of an rvalue of type 'std::__1::basic_ostringstream ' inf = static_cast (&(ostringstream() << (int)pAct.areaThreshold))->str(); ^ ~~ /usr/ports/graphics/opencv3/work/opencv-3.1.0/samples/cpp/detect_mser.cpp:92:39: error: cannot take the address of an rvalue of type 'std::__1::basic_ostringstream ' inf = static_cast (&(ostringstream() << (int)pAct.minMargin))->str();
Re: How compile "String inf = static_cast<ostringstream*>(&(ostringstream() << pAct.minArea))->str();"
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() << pAct.minArea))->str(); There's nothing wrong with this code, provided that: * 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 g...@freebsd.org PGP Public Key: http://gahr.ch/pgp ___ freebsd-ports@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"
Re: How compile "String inf = static_cast<ostringstream*>(&(ostringstream() << pAct.minArea))->str();"
On 09.11.2016 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() << pAct.minArea))->str(); You need to provide us with the *exact* error message from clang. By the way, that line is the text-book definition of code horror, but that's a different story. Patrick -- If you'd like to send me a private message, make sure to remove the "_lists" part from my address. ___ freebsd-ports@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"
How compile "String inf = static_cast<ostringstream*>(&(ostringstream() << pAct.minArea))->str();"
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() << pAct.minArea))->str(); Can someone give me a hint about how to fix it? []'s -Otacilio ___ freebsd-ports@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"