Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-11-21 09:09:20


"Gennadiy Rozental" <gennadiy.rozental_at_[hidden]> writes:

> Just for the hell of it, here is the version (65 lines) that gives compile
> time errors on required parameters and runtime time errors for optional.
>
> template<typename NP1,typename NP2> struct named_parameter_combine;
> template<typename T, typename unique_id> struct named_parameter;
> template<typename unique_id,bool optional> struct keyword;
>
> struct nil {
> template<typename T> operator T() { throw "access_to_invalid_parameter"; return *(T*)0; }
> };

It's easy to pack lots of stuff into few lines when you use a dense,
illgegible coding style with really long lines of source and unaligned
braces. Using our coding style it's 122 lines without namespaces,
comments, include guards, or copyright notices. Not to mention which
it sacrifices compile-time type safety for runtime checks.

Anyone can throw together a less-capable prototype and come out with
smaller code. I don't think it proves much. This is the first review
I've seen where the focus on implementation details is so intense.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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