Здравствуйте!
При переходе с boost 1.33 на boost 1.37 столкнулся с такой проблемой — перестали компилироваться модули, в которых у объектов класса boost::ptr_vector использовался метод sort. Попробовал написать простенький пример, но и он отказался компилироваться. Может быть, кто — нибудь знает, что я делаю не так? (использую VS2008SP1)
#include <iostream>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/utility/addressof.hpp>
//////////////////////////////////////////////////////////////////////////
class IItf
{
public:
virtual void Do() = 0;
virtual ~IItf() { std::cout << "IItf destructor" << std::endl; }
};
//////////////////////////////////////////////////////////////////////////
class IItf_Impl1 : public IItf
{
public:
virtual void Do() { std::cout << "Do in IItf_Impl1" << std::endl; }
virtual ~IItf_Impl1() { std::cout << "IItf_Impl1 destructor" << std::endl; }
};
//////////////////////////////////////////////////////////////////////////
class IItf_Impl2 : public IItf
{
public:
virtual void Do() { std::cout << "Do in IItf_Impl2" << std::endl; }
virtual ~IItf_Impl2() { std::cout << "IItf_Impl2 destructor" << std::endl; }
};
//////////////////////////////////////////////////////////////////////////
class IItf_Impl2_Child : public IItf_Impl2
{
public:
virtual void Do() { std::cout << "Do in IItf_Impl2_Child" << std::endl; }
virtual ~IItf_Impl2_Child() { std::cout << "IItf_Impl2_Child destructor" << std::endl; }
};
//////////////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
boost::ptr_vector<IItf> container;
container.push_back(new IItf_Impl1);
container.push_back(new IItf_Impl2);
container.push_back(new IItf_Impl2);
container.push_back(new IItf_Impl2_Child);
container.push_back(new IItf_Impl2_Child);
struct IItf_compare : public std::binary_function<IItf, IItf, bool>
{
result_type operator()(const first_argument_type& arg1, const second_argument_type& arg2) const
{
return boost::addressof(arg1) < boost::addressof(arg2);
}
};
container.sort(IItf_compare());
}
Выдает ошибку error C2027: use of undefined type 'boost::result_of<F>'
Заранее спасибо!