MESSAGE
DATE | 2017-02-20 |
FROM | Ruben Safir
|
SUBJECT | Subject: [Learn] overloading operator== and casting
|
From learn-bounces-at-nylxs.com Mon Feb 20 10:50:30 2017 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www.mrbrklyn.com (www.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 2BD5316131C; Mon, 20 Feb 2017 10:50:30 -0500 (EST) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from [10.0.0.62] (flatbush.mrbrklyn.com [10.0.0.62]) by mrbrklyn.com (Postfix) with ESMTP id 8EA0E161319 for ; Mon, 20 Feb 2017 10:50:27 -0500 (EST) To: learn-at-nylxs.com From: Ruben Safir Message-ID: <9d60fb8d-dac7-5503-4613-6262eac83a1e-at-mrbrklyn.com> Date: Mon, 20 Feb 2017 10:50:27 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 Subject: [Learn] overloading operator== and casting X-BeenThere: learn-at-nylxs.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
[This mail was also posted to comp.lang.c++.]
I have two object type that I wanted to compare to each other using the operator=3D=3D but to my surprise, which I compiled it, I got a complaint about the different types being used without cast
euler.cpp|113 col 28| error: comparison between distinct pointer types =E2=80=98tree::Predicate*=E2=80=99 and =E2=80=98tree::Node*= =E2=80=99 lacks a cast
my overload operator knows this already
class Predicate{ public: Predicate(Node& in_a, Node& in_b, Edge& in_c) : a{in_a}, b{in_b}, c{in_c}{ a.data++; b.data++; }; ...
bool operator=3D=3D(const Node& first)
Can anyone suggest the cleanest means of working around this annoying error. -- =
So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive http://www.coinhangout.com - coins! http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013 _______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
|
|