From -2644569035765802669
X-Google-Thread: f78e5,be8dba9addd8a207,start
X-Google-NewGroupId: yes
X-Google-Attributes: gid7894ca11fe,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.68.241.7 with SMTP id we7mr7602076pbc.4.1338241986151;
        Mon, 28 May 2012 14:53:06 -0700 (PDT)
MIME-Version: 1.0
Path: pr3ni59971pbb.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!news.albasani.net!.POSTED!not-for-mail
From: Bo Persson<bop@gmb.dk>
Newsgroups: comp.std.c++
Subject: Smart pointer comparison - why a difference?
Date: Mon, 28 May 2012 14:53:04 -0700 (PDT)
Organization: unknown
Lines: 26
Sender: std-cpp-request@vandevoorde.com
Approved: stephen.clamage@oracle.com
Message-ID: <a2i65qF4eeU1@mid.individual.net>
NNTP-Posting-Host: gQPhHN0q0uDq6zeG6rF4GY3b/56H3LhnuCA/HWZ6j4U=
X-Trace: news.albasani.net eIaqqGz2pR8SDaGbHdJEQjYW8TdwHq30IDMr/isJkJVDgPQfdHDd0fVie1PD7xhGE1o1hkVcwDWSLblK9lky9w==
X-Complaints-To: abuse@albasani.net
NNTP-Posting-Date: Mon, 28 May 2012 21:53:05 +0000 (UTC)
X-Mailer: Perl5 Mail::Internet v2.05
X-Submission-Address: std-cpp-submit@vandevoorde.com
Cancel-Lock: sha1:yRGsr0deznjYTFfMxx2QxENT7Oo=
X-Original-Date: Mon, 28 May 2012 22:40:23 +0200
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

In C++11, operator<  for unique_ptr [unique.ptr.special] is defined as

std::less<CT>()(x.get(), y.get())

where CT is the common_type of the unique_ptr's internal pointer typedefs.


On the other hand, operator<  for shared_ptr [util.smartptr.shared.cmp]
is defined as

std::less<V>()(a.get(), b.get())

"where V is the composite pointer type (5.9) of T* and U*."


What exactly is the difference, and why?


Bo Persson


-- 
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]


