allocator implementation

Discussion in 'C Programming' started by George2, Feb 27, 2008.

  1. George2

    George2

    Joined:
    Feb 12, 2008
    Messages:
    108
    Hello everyone,


    I have debugged into STL implementation for allocator in file xmemory (Visual Studio 2008). I found it has not data members, the same as its base class _Allocator_base. Is that correct?

    http://msdn2.microsoft.com/en-us/library/6s8wyf7c.aspx

    My questions is what is the purpose of copy? It always returns true. Here is the code,

    you can see do nothing for copy constructor as well.

    Code (Text):

    allocator(const allocator<_Ty>&) _THROW0()
    {
        // construct by copying (do nothing)
    }

            // allocator TEMPLATE OPERATORS
    template<class _Ty,
        class _Other> inline
        bool operator==(const allocator<_Ty>&, const allocator<_Other>&) _THROW0()
        {   // test for allocator equality (always true)
        return (true);
        }
     

    thanks in advance,
    George
     
    George2, Feb 27, 2008
    #1
    1. Advertisements

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. Dan
    Replies:
    0
    Views:
    499
  2. Fraser Ross

    allocator size_type

    Fraser Ross, Jul 31, 2003, in forum: C++
    Replies:
    1
    Views:
    466
    John Harrison
    Jul 31, 2003
  3. Michael Tsang
    Replies:
    32
    Views:
    1,187
    Richard Bos
    Mar 1, 2010
  4. Michael Tsang
    Replies:
    54
    Views:
    1,270
    Phil Carmody
    Mar 30, 2010
  5. sanket
    Replies:
    7
    Views:
    1,142
    Tsung
    Nov 3, 2011
Loading...

Share This Page