Re: Cannot convert to `int' in initialization
From: Alex Vinokur (alexvn_at_big-foot.com)
Date: 11/25/04
- Next message: Method Man: "Re: virtual constructor"
- Previous message: Alf P. Steinbach: "Re: Cannot convert to `int' in initialization"
- In reply to: Jonathan Turkanis: "Re: Cannot convert to `int' in initialization"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 25 Nov 2004 09:54:24 +0200
"Jonathan Turkanis" <technews@kangaroologic.com> wrote in message news:30lgqtF303ckoU1@uni-berlin.de...
[snip]
> For fun, try:
>
> #include <iostream>
> #include <typeinfo>
>
> struct Foo {
> operator int() const { return 5; }
> };
>
> int main ()
> {
> Foo foo1, foo2;
> for (int i = 0, foo1 = foo2; ; ) {
> std::cout << "typeof foo1 = " << typeid(foo1).name() << "\n";
> std::cout << "foo1 = " << foo1 << "\n";
> break;
> };
> return 0;
> }
>
[snip]
Indeed, very nice.
--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn
- Next message: Method Man: "Re: virtual constructor"
- Previous message: Alf P. Steinbach: "Re: Cannot convert to `int' in initialization"
- In reply to: Jonathan Turkanis: "Re: Cannot convert to `int' in initialization"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|