Boost logo

Boost Users :

From: mwong cmwong_at_[hidden])
Date: 2002-12-21 01:47:41


Hi,

I was trying to compile the following code using VC++ .NET.

#include "stdafx.h"
#include "boost/smart_ptr.hpp"

int _tmain(int argc, _TCHAR* argv[])
{
        boost::shared_ptr<int> spc = new int(0);

        return 0;
}

I got the following error messages:

c:\boost\smart_ptr.hpp(375) : error C2065: 'T' : undeclared identifier
c:\boost\smart_ptr.hpp(375) : error C2687: cannot define a nested UDT
of a template class out of line
c:\boost\smart_ptr.hpp(375) : fatal error C1903: unable to recover
from previous error(s); stopping compilation

The offending code in smart_ptr.hpp is:
template<typename T>
  struct less< boost::shared_ptr<T > > //..... LINE 375
    : binary_function<boost::shared_ptr<T>, boost::shared_ptr<T>,
bool>
  {
    bool operator()(const boost::shared_ptr<T>& a,
        const boost::shared_ptr<T>& b) const
      { return less<T*>()(a.get(),b.get()); }
  };

Can someone please tell me what is the problem? I was able to compile
the same code using VC++ 6.0.

Thanks.

Ming


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net