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

    allocator size_type

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

Share This Page