Help with g++ 6 abs() and templates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



octave has template functions that call abs() on templated variables, something like:

template <class T>
T myfunc(T arg) {
T x = abs(arg);
}


This leads to errors when instantiated for unsigned types because abs(unsigned type) is not defined as is doesn't make sense to do. That's fine and all, but how then does one write generic template code as above that works for signed and unsigned types.

--
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA/CoRA Division                    FAX: 303-415-9702
3380 Mitchell Lane                  orion@xxxxxxxxxxxxx
Boulder, CO 80301              http://www.cora.nwra.com
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
http://lists.fedoraproject.org/admin/lists/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux