struct A {
A();
A(A return&);//move constructor
A(const A &);//copy constructor
void either_side();//operates on both r and l value.
void rvalue() return;//operate on rvalues.
void const_lvalue() const ~return;//operate on const lvalues.
};
struct B {
void F1();//provided for all objects
void F1() return;//specialized for rvalues
void F2();//provide for all objects
void F2() ~return;//specialized for lvalues
void F3() return;//specialized for rvalues
void F3() ~return;//specialized for lvalues
};
Since it is meaningless to declare a value as rvalue,pointers and
objects cannot be declared as rvalue but refrences can,and casting
references from r to l or the vice-versa can be performed via side
casting:
return_cast<~return&> (return_cast<return&> (object));
for further keword extentions in language I suggest separating the
prefix from cast operators and declaring them as following macros in a
popular header:
//cast.h
#ifndef CAST_H
#define CAST_H
#define static_cast static cast
#define dynamic_cast dynamic cast
#define const_cast const cast
#define reinterpret_cast do cast
#define return_cast return cast
#endif
since const , static , do and return are existing keywords ,We have
produced five compound keywords declaring only two actual keywords,
this releases the dynamic keyword for later language extention.
regards,
FM.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std...@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]