This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++0x] nullptr


Paolo Carlini wrote:

> On 05/03/2010 11:55 PM, Benjamin Kosnik wrote:
> > ...yeah, I don't understand why nullptr_t as defined in cstddef
> > isn't just being used instead of using the (oft-repeated)
> > __nullptr_t type.
> > 
> > This applies to shared_ptr/unique_ptr/functional.
> >   
> That's another issue, I think: it's about avoiding including the whole
> cstddef only for that. Indeed, lately - Martin, if I remember
> correctly - pointed out in a DR that essentially all the headers can
> avoid including cstddef, and Magnus' patch goes in that direction...
> 
> Paolo.

I'm working on a private STL of my own (educational purposes, mainly)
and been experimenting with this myself.  It seems to work quite nicely.

0x helps a lot here, as by definition, std::size_t is an alias for
decltype(sizeof(object-type)), so in theory you can deduce the correct
type rather than rely on matching a configuration-specific type by hand.

Similarly, ptrdiff_t is effectively decltype(int*{}-int*{}).

nullptr_t you already have covered <g>.

What I am not clear on is whether the standard expects the std typedef
name to be available through any header that uses it, or merely expects
function signatures with the correctly aliased types.

AlisdairM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]