Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > allocator implementation

Reply
Thread Tools

allocator implementation

 
 
George2 George2 is offline
Senior Member
Join Date: Feb 2008
Posts: 108
 
      02-27-2008
Hello everyone,


I have debugged into STL implementation for allocator in file xmemory (Visual Studio 200. 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insertion Sort : C++ implementation 100 times slower than C implementation sanket C++ 7 11-03-2011 05:00 AM
Knowing the implementation, are all undefined behaviours become implementation-defined behaviours? Michael Tsang C Programming 54 03-30-2010 07:46 AM
Knowing the implementation, are all undefined behaviours become implementation-defined behaviours? Michael Tsang C++ 32 03-01-2010 09:15 PM
allocator size_type Fraser Ross C++ 1 07-31-2003 10:39 PM
[ANN] Thread-aware STL-compatible memory allocator Dan C++ 0 07-29-2003 08:06 PM



Advertisments