strange syntax in stl (gnu version)

Discussion in 'C++' started by Ningyu Shi, Sep 19, 2007.

  1. Ningyu Shi

    Ningyu Shi Guest

    I saw something really wierld in g++ version of stl source.

    void construct(pointer __p, const _Tp& __val) { ::new(__p)
    _Tp(__val); }

    anybody knows about the syntax new(__p) means? can new really take a
    pointer as a parameter?
    Ningyu Shi, Sep 19, 2007
    #1
    1. Advertising

  2. Ningyu Shi

    Ian Collins Guest

    Ningyu Shi wrote:
    > I saw something really wierld in g++ version of stl source.
    >
    > void construct(pointer __p, const _Tp& __val) { ::new(__p)
    > _Tp(__val); }
    >
    > anybody knows about the syntax new(__p) means? can new really take a
    > pointer as a parameter?
    >

    Look up placement new.

    --
    Ian Collins.
    Ian Collins, Sep 19, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter

    1 day gnu, whole life gnu?

    Peter, Jan 10, 2005, in forum: Java
    Replies:
    3
    Views:
    320
    John C. Bollinger
    Jan 10, 2005
  2. Peter
    Replies:
    17
    Views:
    586
    Chris Smith
    Jan 13, 2005
  3. Rolf Hemmerling
    Replies:
    3
    Views:
    924
    tom_usenet
    Oct 10, 2003
  4. V Green
    Replies:
    0
    Views:
    813
    V Green
    Feb 5, 2008
  5. PA Bear [MS MVP]
    Replies:
    0
    Views:
    916
    PA Bear [MS MVP]
    Feb 5, 2008
Loading...

Share This Page