Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-07-13 09:36:41


Scott Schurr wrote:

> Greetings,
>
> Prompted by some discussion on comp.sdt.c++.moderated, I have a
> small template that allows the user to declare an integer literal
> in binary.
>
> Usage looks like:
>
> #include "binary_int.hpp"
>
> unsigned int binary = binary_int<1001,0011,1011,0000>::b;

Why is that better than

  unsigned x = strtoul("1010010001000010000001", 0, 2);

? I believe that 'strtoul' is part of C99.

- Volodya


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