![]() |
Function-in-a-line!!! (C/C++)
Since I have started vision processing, these are nifty functions, that I've consicified into a single line so they are out of the way of your real code!
Code:
//string funcs, requiring string and sstream |
Re: Function-in-a-line!!! (C/C++)
There is a <cmath> function for computing the length of the hypotenuse.
http://www.cplusplus.com/reference/cmath/hypot/ For doing numeric type to string conversions, C++11 supports std::to_string, but without C++11 you could still do your stringstream method with a templated function (since the function body is exactly the same regardless of the argument type). |
Re: Function-in-a-line!!! (C/C++)
Quote:
Code:
template<typename T> |
Re: Function-in-a-line!!! (C/C++)
Templates are the best way to go there. C++11 reportedly has a to_string function in namespace std but it is absent from GCC 4.8.2. Kind of irrelevant seeing as WindRiver uses GCC 3.4.4...
Alex Brinister |
| All times are GMT -5. The time now is 02:31. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi