Thread overview | |||||
---|---|---|---|---|---|
|
January 19, 2003 Boost: is_reference | ||||
---|---|---|---|---|
| ||||
#include <stdio.h> template<typename T> struct is_reference { enum { value = false }; }; template<typename T> struct is_reference<T&> { enum { value = true }; }; int main() { printf("%d\n", is_reference<int>::value); printf("%d\n", is_reference<void (int)>::value); } Compiled with DMC, the output is both times "1" (but I guess it should be 0). Medium-high priority (preferred boost::function syntax depends on it) bye, Christof -- http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net? |
January 20, 2003 Re: Boost: is_reference | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | On Sun, 19 Jan 2003 12:52:50 +0000 (UTC), Christof Meerwald wrote: > #include <stdio.h> > > template<typename T> struct is_reference > { > enum { value = false }; > }; > > template<typename T> struct is_reference<T&> > { > enum { value = true }; > }; > > int main() > { > printf("%d\n", is_reference<int>::value); > printf("%d\n", is_reference<void (int)>::value); > } > > Compiled with DMC, the output is both times "1" (but I guess it should be > 0). Medium-high priority (preferred boost::function syntax depends on it) With DMC 8.33.3 I now also get a "0" for printf("%d\n", is_reference<int &>::value); bye, Christof -- http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net? |
March 13, 2003 Re: Boost: is_reference | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | Christof Meerwald <cmeerw@web.de> wrote in news:b0h1qp$15qs$1@digitaldaemon.com: > On Sun, 19 Jan 2003 12:52:50 +0000 (UTC), Christof Meerwald wrote: >> #include <stdio.h> >> >> template<typename T> struct is_reference >> { >> enum { value = false }; >> }; >> >> template<typename T> struct is_reference<T&> >> { >> enum { value = true }; >> }; >> >> int main() >> { >> printf("%d\n", is_reference<int>::value); >> printf("%d\n", is_reference<void (int)>::value); >> } >> >> Compiled with DMC, the output is both times "1" (but I guess it >> should be 0). Medium-high priority (preferred boost::function syntax >> depends on it) > > With DMC 8.33.3 I now also get a "0" for > > printf("%d\n", is_reference<int &>::value); > > > bye, Christof Interesting, the output of Borland's C++ builder 5 for the line "printf("%d\n", is_reference<int>::value);" is 0 (zero) but it won't compile the line "printf("%d\n", is_reference<void (int)>::value);". I guess the second line is a typo, right? With "printf("%d\n", is_reference<int &>::value);" Borland's compiler will output 1. /gf |
Copyright © 1999-2021 by the D Language Foundation