Lack of pointer Typedef in STL container

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ManicQin

    Lack of pointer Typedef in STL container

    Looking at vector's header I can see that they provided me with a:
    typedef A::reference reference;

    But there's no typedef for a pointer to A...

    Don't get me wrong I can easily write vector<someting >::value_type *
    but it makes me wonder why supplying a typedef for reference
    and not for pointer? Any special reasons you know of?
  • Victor Bazarov

    #2
    Re: Lack of pointer Typedef in STL container

    ManicQin wrote:
    Looking at vector's header I can see that they provided me with a:
    typedef A::reference reference;
    >
    But there's no typedef for a pointer to A...
    >
    Don't get me wrong I can easily write vector<someting >::value_type *
    but it makes me wonder why supplying a typedef for reference
    and not for pointer? Any special reasons you know of?
    The type 'reference' is returned by 'back' or 'front'. Probably due
    to the presence of 'vector<bool>' specialisation, which does *not*
    have 'reference' as the synonym to 'bool&' prompted the creation of
    the 'reference' type. 'pointer' is simply not needed anywhere.

    Correct me, somebody.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask


    Comment

    • Barry

      #3
      Re: Lack of pointer Typedef in STL container

      On Apr 10, 10:20 pm, ManicQin <Manic...@gmail .comwrote:
      Looking at vector's header I can see that they provided me with a:
      typedef A::reference reference;
      >
      But there's no typedef for a pointer to A...
      >
      Don't get me wrong I can easily write vector<someting >::value_type *
      but it makes me wonder why supplying a typedef for reference
      and not for pointer? Any special reasons you know of?
      C++03 has "pointer" typedef.

      What's implementation you checked out?

      Here I check out sgi, it has "pointer"
      VC2005, it has

      Comment

      • ManicQin

        #4
        Re: Lack of pointer Typedef in STL container

        On Apr 10, 5:48 pm, Barry <dhb2...@gmail. comwrote:
        On Apr 10, 10:20 pm, ManicQin <Manic...@gmail .comwrote:
        >
        Looking at vector's header I can see that they provided me with a:
        typedef A::reference reference;
        >
        But there's no typedef for a pointer to A...
        >
        Don't get me wrong I can easily write vector<someting >::value_type *
        but it makes me wonder why supplying a typedef for reference
        and not for pointer? Any special reasons you know of?
        >
        C++03 has "pointer" typedef.
        >
        What's implementation you checked out?
        >
        Here I check out sgi, it has "pointer"
        VC2005, it has
        You're right, The first time I checked in VS6 but after your post I
        checked my VS Express and found it.
        Thanks.

        Comment

        Working...