469,950 Members | 2,065 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

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 2007
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by denis wendum | last post: by
20 posts views Thread by KL | last post: by
18 posts views Thread by uday | last post: by
5 posts views Thread by Jerry Fleming | last post: by
3 posts views Thread by johnmmcparland | last post: by
15 posts views Thread by PengYu.UT | last post: by
7 posts views Thread by Rahul | last post: by
2 posts views Thread by jimzat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.