Boost logo

Boost Users :

From: Ian McCulloch (ianmcc_at_[hidden])
Date: 2005-02-15 19:11:24


Chris Goller wrote:

> David-
>
> First, thanks for the response. BTW, I really like the book.
>
> Okay, I understand what you are saying about add_const and how it works.
>
> My next question is why was it implemented in that way? In other words,
> was there a specific reason not to make a special case
> for references such that add_const<int&> would be int const &?

FWIW, you will soon be able to get that effect without a metafunction.
from http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#106
[example]
int i;
typedef int& RI;
RI& r = i; // r has the type int&
const RI& r = i; // r has the type const int&
[/example]

I'm not sure I like it, because a 'RI const' is 'int&', but a reference to a
'RI const' is 'int const&'. But maybe its useful that way.

Cheers,
Ian McCulloch


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net