-=> Quoting Bob Stout to All
BS> I'm not sure I have the latest in either books or compilers to do
BS> it properly, so I thought I'd ask here. In concocting some GCD code
BS> for the next SNIPPETS release, I came across a problem with
BS> template-based code that required the use of the % operator. In C, I
BS> have to make type-specific versions, so the function which works with
BS> doubles simply uses fmod() instead of %. However, I'm kinda lost when
BS> it comes to writing a template-based equivalent which will need to
BS> either use the % operator or call fmod() depending on the type of its
BS> arguments and return value.
The closest you can really come, unfortunately, is to write a special "mod"
function for each type, and a template that calls it...
The other way, the way the STL does things, requires you to not use built-in
types (one of the problems with having an only-partially object oriented
language...).
... Dream come true: Beta testing for a brewery.
--- FastEcho 1.46
---------------
* Origin: House of Fire BBS - Toronto - (416)601-0085 - v.34 (1:250/536)
|