www.digitalmars.com         C & C++   DMDScript  

c++.beta - Boost: is_reference

reply Christof Meerwald <cmeerw web.de> writes:
#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?
Jan 19 2003
parent reply Christof Meerwald <cmeerw web.de> writes:
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?
Jan 20 2003
parent gf <mz_y2k yahoo..com> writes:
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
Mar 13 2003