When someone thinks about a new version of C++, how about including
these:
-----------------------
typeof:
class A
{
public:
void foo();
} a;
typefo(a) b;
b.foo();
-----------------------
typeofbase:
class A
{
public:
foo();
};
class B : public A
{
foo() {typeofbase::foo();} // calls: A::foo();
};
--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);} 12 1383
On Wed, 15 Jun 2005 11:41:06 +0200, "Gernot Frisch" <Me@Privacy.net>
wrote: When someone thinks about a new version of C++, how about including these:
[snip]
comp.std.c++ is the place to ask this question.
--
Bob Hairgrove No**********@Home.com
Gernot Frisch wrote: When someone thinks about a new version of C++, how about including these:
As Bob Hairgrove said, clc++ is the place for this. But a suggestion:
instead of proposing keywords, talk about what problem you're trying to
solve. Syntax comes later.
--
Pete Becker
Dinkumware, Ltd. ( http://www.dinkumware.com)
"Gernot Frisch" <Me@Privacy.net> wrote in message
news:3h************@individual.net... When someone thinks about a new version of C++, how about including these:
----------------------- typeof: class A { public: void foo(); } a;
typefo(a) b; b.foo();
----------------------- typeofbase:
class A { public: foo(); };
class B : public A { foo() {typeofbase::foo();} // calls: A::foo(); };
-- -Gernot int main(int argc, char** argv) {printf
Why would you need that? Can't you just look and see the type you want? It
looks like all you're saving is some effort on your part to know what you're
doing. It's not like you suddenly want a new type for b because you're
changing the type of a, or that your base class simply changes at some
point. Such changes would generally involve how you use the objects, not
just their type. Do you have a real-world problem that this solves?
-Howard
Howard wrote: Why would you need that? Can't you just look and see the type you want? It looks like all you're saving is some effort on your part to know what you're doing. It's not like you suddenly want a new type for b because you're changing the type of a, or that your base class simply changes at some point. Such changes would generally involve how you use the objects, not just their type. Do you have a real-world problem that this solves?
Here are a couple of examples where typeof/decltype/auto would be
useful:
1)
#include <boost/lambda/lambda.hpp>
using namespace boost::lambda;
auto var = 15 < _1 && _1 < 20;
(the type is too complicated to specify by hand)
2)
template<class T, class U>
typeof(T() + U()) add(T t, U u)
{
return t + u;
}
(it's impossible to specify the type by hand)
A library-based implementation of typeof has been recently accepted
into Boost and will most likely become available as a part of Boost
starting version 1.34. See http://boost-sandbox.sourceforge.net/vault/, typeof.zip for the current
version.
Regards,
Arkadiy
Arkadiy wrote: Howard wrote:
Why would you need that? [...]
Here are a couple of examples where typeof/decltype/auto would be useful: [...]
To put your discussion to end, there is a proposal to introduce the
keyword 'decltype' and reuse 'auto' for those purposes. See N1607: http://www.open-std.org/jtc1/sc22/wg...2004/n1607.pdf
I am surprised that you kept posting about those, the proposal has been
around for quite a while. Perhaps you should just go to the Standard
Committee site ( http://www.open-std.org/jtc1/sc22/wg21/) and peruse it
for some time before arguing again... :-)
V
Howard wrote: Why would you need that? Can't you just look and see the type you want? It looks like all you're saving is some effort on your part to know what you're doing. It's not like you suddenly want a new type for b because you're changing the type of a, or that your base class simply changes at some point. Such changes would generally involve how you use the objects, not just their type. Do you have a real-world problem that this solves?
Here are a couple of examples where typeof/decltype/auto would be
useful:
1)
#include <boost/lambda/lambda.hpp>
using namespace boost::lambda;
auto var = 15 < _1 && _1 < 20;
(the type is too complicated to specify by hand)
2)
template<class T, class U>
typeof(T() + U()) add(T t, U u)
{
return t + u;
}
(it's impossible to specify the type by hand)
A library-based implementation of typeof has been recently accepted
into Boost and will most likely become available as a part of Boost
starting version 1.34. See http://boost-sandbox.sourceforge.net/vault/, typeof.zip for the current
version.
Regards,
Arkadiy
Well, if you like you can wait until this proposal is accepted, and
then until the compiler vendors implement it...
Or you can have something that works right now (see the Boost sandbox
file vault).
Regards,
Arkadiy
Arkadiy wrote: Well, if you like you can wait until this proposal is accepted, and then until the compiler vendors implement it...
Or you can have something that works right now (see the Boost sandbox file vault).
I am not sure I understand. Works right now how? You're proposing new
keywords to be added to the language, no? Without actually adding them
(and that's the job for compiler implementors) how is "something" going
to satisfy your need for new keywords?
V
Victor Bazarov wrote: Arkadiy wrote:
Well, if you like you can wait until this proposal is accepted, and then until the compiler vendors implement it...
Or you can have something that works right now (see the Boost sandbox file vault).
I am not sure I understand. Works right now how? You're proposing new keywords to be added to the language, no? Without actually adding them (and that's the job for compiler implementors) how is "something" going to satisfy your need for new keywords?
And, of course, this raises the complementary question: if there's
something that works right now, why is a new keyword needed?
--
Pete Becker
Dinkumware, Ltd. ( http://www.dinkumware.com)
I am not proposing new keywords added -- other people are, and I do
agree with them.
However, the process of implementing language changes is quite lengthy.
OTOH, the feature is so useful that one can benefit even from the
limited solution a library can implement.
In our case the limitation is that one has to "tell" the library about
user-defined types/templates by "registering" them, something like:
BOOST_TYPEOF_REGISTER_TYPE(foo)
BOOST_TYPEOF_REGISTER_TEMPLATE(bar, 2) // 2 template parameters
After this is done any combination of registered types/templates can be
handled, in case of my earlier lambda example:
BOOST_AUTO(x, 15 < _1 && _1 < 20); /* equivalent to: auto x = 15 < _1
&& _1 < 20; */
Regards,
Arkadiy
Because a library-based solution has limitations that can't be avoided.
Regards,
Arkadiy
Arkadiy wrote: Because a library-based solution has limitations that can't be avoided.
Regards, Arkadiy
Was this an advertisement for Boost or bringing up someone else's want
for keywords to stir debate? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Nel |
last post by:
Hi all,
Before I re-invent the wheel here, has anyone willing to share a basic
script to extract META keywords from a string. I have a string, let's say
$pageText that contains the dynamic...
|
by: Cherry |
last post by:
I have a trigger that won't compile:
CREATE OR REPLACE TRIGGER TRG_CORRESPONDENCE_UPT
AFTER UPDATE
on TBLCORRESPONDENCE
for each row
BEGIN
IF :OLD.Keywords <> :NEW.Keywords THEN
|
by: Jason Heyes |
last post by:
I want to write a class that supports operations on keywords belonging to
the C++ programming language. The following program repeatedly prompts the
user for a keyword until 'explicit' is finally...
|
by: google |
last post by:
I have a script which parses the BBC RSS feed once an hour, and drops
any stories with certain keywords into a database. I would like to ban
certain strings; at the moment the script will pick up...
|
by: dw |
last post by:
Hi, everyone. I'm having difficulty understanding the difference of the
keywords "friend" and "protected" vs. some of the other ways you can declare
variables in ASP.NET ("dim", "public", and...
|
by: Digital.Rebel.18 |
last post by:
I'm trying to figure out how to extract the keywords from an HTML
document.
The input string would typically look like:
<meta name='keywords' content='word1, more stuff, etc'>
Either single...
|
by: JP SIngh |
last post by:
Hi All
This is a complicated one, not for the faint hearted :) :) :)
Please help if you can how to achieve this search.
We have a freetext search entry box to allow users to search the...
|
by: Nenad Loncarevic |
last post by:
I am a geologist, and over the years I've accumulated quite a number
of proffesional papers on the subject, in various publications. I
would like to make a database that would help me find the...
|
by: mforema |
last post by:
Hi Everyone,
I want to search records by typing in multiple keywords. I currently have a search form. It has a combo box, text box, Search command button, and a subform. The combo box lists the...
|
by: =?Utf-8?B?UGV0ZXI=?= |
last post by:
How can I get the list of connection string's keywords available in sqlclient
programmatically? I have found the list in here...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |