473,407 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Overloading composite operators?

bq
Hello,
This post is really two questions.
Question 1:
What is the current status on a revision of ISO C++, specifically
regarding plans for overloading composite operators? Some people in
this group probably would know. By "overloading composite operators" I
mean conversion of an expression like
A = B * C;
into a single function call (instead of three calls; one to "*",
another to copy and another to "="). Here A, B and C are of a
user-defined class type, say a type that represents matrices.

Question 2:
I've read quite a bit about using "lazy evaluation" to avoid
unnecessary copying. Lazy evaluation seems fairly complex and runs
into problems when an object appears more than once in an expression
e.g. matrix multiplication of the form
A = A * A;
or
A = B + C * A;
The advantage of overlaoding the composites "= *", "= +", etc, is that
the function that gets to do the work will have access to A, B and C,
so it can detect any aliasing and then behave accordingly. I am new to
C++ (only read Koenig & Moo, currently reading Josuttis' STL book), so
I'd like to know what the experts think of this issue. Does
overloading composite operators obviate the need for lazy evaluation?

Thanks.
bq
Jul 22 '05 #1
2 2252
On 12 Aug 2004 15:09:37 -0700, fo**********@yahoo.com (bq) wrote in
comp.lang.c++:
Hello,
This post is really two questions.
Question 1:
What is the current status on a revision of ISO C++, specifically
regarding plans for overloading composite operators? Some people in
this group probably would know. By "overloading composite operators" I
mean conversion of an expression like
A = B * C;
into a single function call (instead of three calls; one to "*",
another to copy and another to "="). Here A, B and C are of a
user-defined class type, say a type that represents matrices.

Question 2:
I've read quite a bit about using "lazy evaluation" to avoid
unnecessary copying. Lazy evaluation seems fairly complex and runs
into problems when an object appears more than once in an expression
e.g. matrix multiplication of the form
A = A * A;
or
A = B + C * A;
The advantage of overlaoding the composites "= *", "= +", etc, is that
the function that gets to do the work will have access to A, B and C,
so it can detect any aliasing and then behave accordingly. I am new to
C++ (only read Koenig & Moo, currently reading Josuttis' STL book), so
I'd like to know what the experts think of this issue. Does
overloading composite operators obviate the need for lazy evaluation?

Thanks.
bq


This group discusses the C++ language as it is. If you want to ask
questions about, or make proposals for, new language features in
future versions of the C++ standard, you need to post to the moderated
newsgroup news:comp.std.c.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 22 '05 #2
Jack Klein wrote:
[...]
This group discusses the C++ language as it is. If you want to ask
questions about, or make proposals for, new language features in
future versions of the C++ standard, you need to post to the moderated
newsgroup news:comp.std.c.


Correction:

news:comp.std.c++
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: denis wendum | last post by:
In a nutshell: What is the equivalent of __radd__ (wich overloads the right hand side of +) when overloading the comparison operators <,>,== and so on. My first guess __rlt__ for overloading the...
20
by: KL | last post by:
I am working on a school assignment, so please don't tell me the solution. I just want some direction. I am supposed to overload the >, <, ==, !=, >=, and <= operators using bool. I am having...
18
by: uday | last post by:
Does C supports overloading. I am thinking no. But some people are saying yes. If yes how. Please answer with examples. Also in c++ size of empty class is one. why. and what are the default...
5
by: Jerry Fleming | last post by:
As I am newbie to C++, I am confused by the overloading issues. Everyone says that the four operators can only be overloaded with class member functions instead of global (friend) functions: (), ,...
3
by: johnmmcparland | last post by:
Hi all, I know it is possible to overload the operators and < in C++ but how can I do this. Assume I have a class Date with three int members, m_day, m_month and m_year. In the .cpp files I...
15
by: PengYu.UT | last post by:
Hi, It seems that C++ does not allow overloading operators for primative types, e.g. int, double. I'm wondering whether it is ture or there is some walk-around? Thanks, Peng #include...
8
by: Wayne Shu | last post by:
Hi everyone, I am reading B.S. 's TC++PL (special edition). When I read chapter 11 Operator Overloading, I have two questions. 1. In subsection 11.2.2 paragraph 1, B.S. wrote "In particular,...
7
by: Rahul | last post by:
Hi Everyone, I was overloading the operator= function as a class member function, #include <iostream.h> class A { int value; public : A& operator = (const A& ref)
2
by: jimzat | last post by:
I am trying to simulate the execution of some PLC ladder logic in python. I manually modified the rungs and executed this within python as a proof of concept, but I'd like to be able to skip the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.