0
struct tagEnumdef{}; struct tagName{}; struct tagWidget{};
template< class type > class ParamTags;
template<> class ParamTags<int> { public: typedef tagEnumdef tag; };
template<> class ParamTags<QString> { public: typedef tagName tag; };
template<> class ParamTags<QWidget*>{ public: typedef tagWidget tag; };
typedef boost::multi_index::multi_index_container
<
ParamRegistrationEntry,
boost::multi_index::indexed_by
<
boost::multi_index::ordered_unique< boost::multi_index::tag<tagEnumdef>, BOOST_MULTI_INDEX_CONST_MEM_FUN(ParamRegistrationEntry, int, enumdef) >,
boost::multi_index::ordered_unique< boost::multi_index::tag<tagName>, BOOST_MULTI_INDEX_CONST_MEM_FUN(ParamRegistrationEntry, QString, name ) >,
boost::multi_index::ordered_unique< boost::multi_index::tag<tagWidget>, BOOST_MULTI_INDEX_CONST_MEM_FUN(ParamRegistrationEntry, QWidget*, widget ) >
>
>
> ParamRegisterIndexContainer;
T t_; // int, QString or QWidget*
ParamRegisterIndexContainer* const register_;
register_->modify(register_->get<ParamTags<T>::tag>().find(t_), ...); // C2664
error C2664: 'bool boost::multi_index::detail::ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>::modify<boost::lambda::lambda_functor<T>>(boost::multi_index::detail::bidir_node_iterator<Node>,Modifier)' :
cannot convert parameter 1
from 'boost::multi_index::detail::bidir_node_iterator<Node>'
to 'boost::multi_index::detail::bidir_node_iterator<Node>'
With
Node=ordered_index_node<index_node_base<...>>
Node=ordered_index_node<ordered_index_node<ordered_index_node<index_node_base<...>>
我已經剝離了一些不重要的零件。 3 ordered_index_node是否與我在容器中定義的3個鍵相關?我用get()從1索引獲得迭代器,但是modify()似乎需要某種組合?升壓多指標容器的修改項目