gpt4 book ai didi

.select_on_container_copy_construction 左侧的 C++ boost::geometry::index::rtree 必须具有类/结构/union

转载 作者:行者123 更新时间:2023-11-30 02:45:04 27 4
gpt4 key购买 nike

我正在尝试使用 boost::geometry::index::rtree 但出现以下错误 left of'.select_on_container_copy_construction' must have class/struct/union/inside文件 has_member_function_callable_with.hpp

这是我的代码:

class A;

typedef boost::intrusive_ptr<A> SharedA;
typedef boost::geometry::model::box<Vector2f> Box2D;

namespace boost {
namespace geometry {
namespace traits {
template<typename _Scalar, int _Cols>
struct tag<Vector<_Scalar, _Cols> >
{
typedef point_tag type;
};

template<typename _Scalar, int _Cols>
struct coordinate_type<Vector<_Scalar, _Cols> >
{
typedef _Scalar type;
};

template<typename _Scalar, int _Cols>
struct coordinate_system<Vector<_Scalar, _Cols> >
{
typedef cs::cartesian type;
};

template<typename _Scalar, int _Cols>
struct dimension<Vector<_Scalar, _Cols> > : boost::mpl::int_<_Cols>{};

template<typename _Scalar, int _Cols, std::size_t Dimension>
struct access<Vector<_Scalar, _Cols>, Dimension>
{
static inline _Scalar get(Vector<_Scalar, _Cols> const &matrix)
{
return matrix[Dimension];
}

static inline void set(Vector<_Scalar, _Cols> &matrix, _Scalar const &value)
{
matrix[Dimension] = value;
}
};
}
namespace index {

// apparently necessary:
template <typename Box>
struct indexable< boost::intrusive_ptr<Box> >
{
typedef boost::intrusive_ptr<Box> V;
typedef Box2D const& result_type;
result_type operator()(V const& v) const { return v->getBox(); }
};

}
}
}

class A {
public:
Vector3f position;
float distance;

const Box2D& getBox() const {
Box2D box(Vector2f(position[0] - distance, position[1] - distance), Vector2f(position[0] + distance, position[1] + distance));
return const_cast<Box2D&>(box);
}
}

class Tree {
private:
boost::geometry::index::rtree<SharedA, boost::geometry::index::rstar<16, 4>> tree;
}

输出:

1>  tree.cpp
1>x\include\boost\intrusive\detail\has_member_function_callable_with.hpp(200): error C2228: left of '.select_on_container_copy_construction' must have class/struct/union
1> type is 'boost::move_detail::add_rvalue_reference<U>::type'
1> x\include\boost\intrusive\detail\has_member_function_callable_with.hpp(276) : see reference to class template instantiation 'boost::container::container_detail::has_member_function_callable_with_select_on_container_copy_construction_impl<Fun,true,>' being compiled
1> with
1> [
1> Fun=std::allocator<boost::geometry::index::detail::rtree::dynamic_leaf<boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>>
1> ]
1> x\include\boost\container\allocator_traits.hpp(262) : see reference to class template instantiation 'boost::container::container_detail::has_member_function_callable_with_select_on_container_copy_construction<const Alloc,>' being compiled
1> with
1> [
1> Alloc=std::allocator<boost::geometry::index::detail::rtree::dynamic_leaf<boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>>
1> ]
1> x\include\boost\geometry\index\detail\rtree\node\node_d_mem_dynamic.hpp(257) : see reference to class template instantiation 'boost::container::allocator_traits<AllocNode>' being compiled
1> with
1> [
1> AllocNode=std::allocator<boost::geometry::index::detail::rtree::dynamic_leaf<boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>>
1> ]
1> x\include\boost\geometry\index\detail\rtree\node\node_d_mem_dynamic.hpp(320) : see reference to function template instantiation 'BaseNodePtr boost::geometry::index::detail::rtree::create_dynamic_node<BaseNodePtr,boost::geometry::index::detail::rtree::dynamic_leaf<Value,Parameters,Box,Allocators,boost::geometry::index::detail::rtree::node_d_mem_static_tag>>::apply<std::allocator<_Other>>(AllocNode &)' being compiled
1> with
1> [
1> BaseNodePtr=boost::geometry::index::detail::rtree::dynamic_node<boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>,boost::geometry::index::detail::rtree::node_d_mem_static_tag> *
1> , Value=boost::intrusive_ptr<A>
1> , Parameters=boost::geometry::index::rstar<16,4,4,32>
1> , Box=boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>
1> , Allocators=boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>
1> , _Other=boost::geometry::index::detail::rtree::dynamic_leaf<boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>
1> , AllocNode=std::allocator<boost::geometry::index::detail::rtree::dynamic_leaf<boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>>
1> ]
1> x\include\boost\geometry\index\detail\rtree\node\node_d_mem_dynamic.hpp(320) : see reference to function template instantiation 'BaseNodePtr boost::geometry::index::detail::rtree::create_dynamic_node<BaseNodePtr,boost::geometry::index::detail::rtree::dynamic_leaf<Value,Parameters,Box,Allocators,boost::geometry::index::detail::rtree::node_d_mem_static_tag>>::apply<std::allocator<_Other>>(AllocNode &)' being compiled
1> with
1> [
1> BaseNodePtr=boost::geometry::index::detail::rtree::dynamic_node<boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>,boost::geometry::index::detail::rtree::node_d_mem_static_tag> *
1> , Value=boost::intrusive_ptr<A>
1> , Parameters=boost::geometry::index::rstar<16,4,4,32>
1> , Box=boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>
1> , Allocators=boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>
1> , _Other=boost::geometry::index::detail::rtree::dynamic_leaf<boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>
1> , AllocNode=std::allocator<boost::geometry::index::detail::rtree::dynamic_leaf<boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>>
1> ]
1> x\include\boost\geometry\index\detail\rtree\node\node_d_mem_dynamic.hpp(316) : while compiling class template member function 'boost::geometry::index::detail::rtree::dynamic_node<Value,Parameters,Box,Allocators,boost::geometry::index::detail::rtree::node_d_mem_static_tag> *boost::geometry::index::detail::rtree::create_node<Allocators,boost::geometry::index::detail::rtree::dynamic_leaf<Value,Parameters,Box,Allocators,boost::geometry::index::detail::rtree::node_d_mem_static_tag>>::apply(Allocators &)'
1> with
1> [
1> Value=boost::intrusive_ptr<A>
1> , Parameters=boost::geometry::index::rstar<16,4,4,32>
1> , Box=boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>
1> , Allocators=boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>
1> ]
1> x\include\boost\geometry\index\rtree.hpp(1267) : see reference to function template instantiation 'boost::geometry::index::detail::rtree::dynamic_node<Value,Parameters,Box,Allocators,boost::geometry::index::detail::rtree::node_d_mem_static_tag> *boost::geometry::index::detail::rtree::create_node<Allocators,boost::geometry::index::detail::rtree::dynamic_leaf<Value,Parameters,Box,Allocators,boost::geometry::index::detail::rtree::node_d_mem_static_tag>>::apply(Allocators &)' being compiled
1> with
1> [
1> Value=boost::intrusive_ptr<A>
1> , Parameters=boost::geometry::index::rstar<16,4,4,32>
1> , Box=boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>
1> , Allocators=boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>
1> ]
1> x\include\boost\geometry\index\rtree.hpp(1267) : see reference to class template instantiation 'boost::geometry::index::detail::rtree::create_node<boost::geometry::index::detail::rtree::allocators<std::allocator<_Ty>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>,boost::geometry::index::detail::rtree::dynamic_leaf<Value,Parameters,Box,Allocators,boost::geometry::index::detail::rtree::node_d_mem_static_tag>>' being compiled
1> with
1> [
1> _Ty=SharedA
1> , Value=boost::intrusive_ptr<A>
1> , Parameters=boost::geometry::index::rstar<16,4,4,32>
1> , Box=boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>
1> , Allocators=boost::geometry::index::detail::rtree::allocators<std::allocator<SharedA>,boost::intrusive_ptr<A>,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::model::box<boost::geometry::model::point<float,2,boost::geometry::cs::cartesian>>,boost::geometry::index::detail::rtree::node_d_mem_static_tag>
1> ]
1> x\include\boost\geometry\index\rtree.hpp(1264) : while compiling class template member function 'void boost::geometry::index::rtree<SharedA,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::index::indexable<Value>,boost::geometry::index::equal_to<Value>,std::allocator<_Ty>>::raw_create(void)'
1> with
1> [
1> Value=SharedA
1> , _Ty=SharedA
1> ]
1> x\include\boost\geometry\index\rtree.hpp(544) : see reference to function template instantiation 'void boost::geometry::index::rtree<SharedA,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::index::indexable<Value>,boost::geometry::index::equal_to<Value>,std::allocator<_Ty>>::raw_create(void)' being compiled
1> with
1> [
1> Value=SharedA
1> , _Ty=SharedA
1> ]
1> x\src\tree.h(35) : see reference to class template instantiation 'boost::geometry::index::rtree<SharedA,boost::geometry::index::rstar<16,4,4,32>,boost::geometry::index::indexable<Value>,boost::geometry::index::equal_to<Value>,std::allocator<_Ty>>' being compiled
1> with
1> [
1> Value=SharedA
1> , _Ty=SharedA
1> ]

我找不到我做错了什么。

最佳答案

这似乎是 boost 1.55.0 中的错误,升级到 1.56.0(仍然是测试版)似乎可以解决这个问题。

关于.select_on_container_copy_construction 左侧的 C++ boost::geometry::index::rtree 必须具有类/结构/union ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24838004/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com