Boost logo

Boost :

From: Kevin Wheatley (hxpro_at_[hidden])
Date: 2006-03-26 15:49:19


Marcus Mendenhall wrote:
> I have started trying to templatize c2_functions, but I have a
> question for the Boost group. Realistically, this class is fairly
> meaningless for anything other than double and long double types. I

what is wrong with float ? or even Half floats? assuming the user's
precision does not need more than that

> Would it be objectionable to the Boost concept to release a basic
> version of the which is strictly for doubles, with the knowledge
> that, for the few people who want it for long doubles, this can be
> done with a global search & substitute, and then to plan later for a
> successor to this which is fully templatized?

sounds like a typedef would solve this to me,

template <typename realType = double, typename container =
std::vector<realType> >
class NotSoEasyForUser
{
...

}

// this is a convenience type
typedef NotSoEasyForUser<> EasyForUser;

with this form you wouldn't even need to provide defaults. It is also
reasonably easy to use compile time constraints to ensure that the
types passed to the template instansiation have to correct concepts,
for example realType truly is a type with the properties of a real
number or if not then a sensible error can be generated by the
compiler, Boost has a number of facilities to aid with this
(BOOST_STATIC_ASSERT comes to mind).

Kevin

-- 
| Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this      |
| Senior Technology                     | My employer for certain |
| And Network Systems Architect         | Not even myself         |

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk