strange syntax in stl (gnu version) - c++

This is a discussion on strange syntax in stl (gnu version) - c++ ; 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?...

+ Reply to Thread
Results 1 to 2 of 2

strange syntax in stl (gnu version)

  1. Default strange syntax in stl (gnu version)

    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?


  2. Default Re: strange syntax in stl (gnu version)

    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.

+ Reply to Thread

Similar Threads

  1. Strange syntax
    By Application Development in forum C
    Replies: 19
    Last Post: 12-08-2007, 09:14 PM
  2. A strange syntax ...
    By Application Development in forum C
    Replies: 3
    Last Post: 07-09-2007, 10:41 PM
  3. Replies: 0
    Last Post: 12-20-2005, 05:56 AM
  4. Strange syntax??
    By Application Development in forum Perl
    Replies: 1
    Last Post: 03-20-2005, 02:08 AM
  5. strange syntax: $var'token
    By Application Development in forum Perl
    Replies: 1
    Last Post: 09-15-2004, 01:23 AM