我想使用boost::icl::interval_map
的共享指针,类似于以下内容:
namespace icl = boost::icl;
icl::interval_map<int, std::shared_ptr<const std::string>> party;
const auto mary = std::make_shared<const std::string>("Mary");
party += make_pair(icl::interval<int>::right_open(10, 16), mary);
std::shared_ptr
实际指向必须通过指针引用的抽象类(不是std::string
,如示例中所示)(因此问题)。
以下是上述代码段产生的一些编译器错误。看起来模板演绎失败了,但我不清楚编译器应该使用哪些过载。任何更熟悉ICL(或阅读这些错误)的人都可以用英语解释发生了什么吗?
Scanning dependencies of target SourceFile
[100%] Building CXX object SourceFile.cpp.o
In file included from /ext-lib/include/boost/icl/map.hpp:38:0,
from /ext-lib/include/boost/icl/interval_base_map.hpp:25,
from /ext-lib/include/boost/icl/interval_map.hpp:14,
from /home/user/SourceFile.cpp:1:
/ext-lib/include/boost/icl/functors.hpp: In instantiation of ‘void boost::icl::inplace_plus<Type>::operator()(Type&, const Type&) const [with Type = std::shared_ptr<const std::__cxx11::basic_string<char> >]’:
/ext-lib/include/boost/icl/interval_base_map.hpp:898:19: required from ‘void boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::add_rear(const interval_type&, const CodomainT&, boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator&) [with Combiner = boost::icl::inplace_plus<std::shared_ptr<const std::__cxx11::basic_string<char> > >; SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::interval_type = boost::icl::discrete_interval<int, std::less>; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > > >]’
/ext-lib/include/boost/icl/interval_base_map.hpp:968:27: required from ‘boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::_add(const segment_type&) [with Combiner = boost::icl::inplace_plus<std::shared_ptr<const std::__cxx11::basic_string<char> > >; SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > > >; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/interval_base_map.hpp:315:9: required from ‘SubType& boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::add(const segment_type&) [with SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/concept/interval_map.hpp:149:30: required from ‘typename boost::enable_if<boost::icl::is_interval_map<Type>, Type>::type& boost::icl::add(Type&, const typename Type::segment_type&) [with Type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename boost::enable_if<boost::icl::is_interval_map<Type>, Type>::type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename Type::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/concept/interval_associator.hpp:305:20: required from ‘typename boost::enable_if<boost::icl::is_intra_derivative<Type, AssociateT>, Type>::type& boost::icl::operator+=(Type&, const OperandT&) [with Type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; OperandT = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename boost::enable_if<boost::icl::is_intra_derivative<Type, AssociateT>, Type>::type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/home/user/SourceFile.cpp:96:68: required from here
/ext-lib/include/boost/icl/functors.hpp:73:18: error: no match for ‘operator+=’ (operand types are ‘std::shared_ptr<const std::__cxx11::basic_string<char> >’ and ‘const std::shared_ptr<const std::__cxx11::basic_string<char> >’)
{ object += operand; }
~~~~~~~^~~~~~~~~~
In file included from /ext-lib/include/boost/icl/associative_interval_container.hpp:18:0,
from /ext-lib/include/boost/icl/interval_base_set.hpp:24,
from /ext-lib/include/boost/icl/interval_set.hpp:14,
from /ext-lib/include/boost/icl/interval_map.hpp:13,
from /home/user/SourceFile.cpp:1:
/ext-lib/include/boost/icl/concept/interval_associator.hpp:303:1: note: candidate: template<class Type, class OperandT> typename boost::enable_if<boost::icl::is_intra_derivative<Type, AssociateT>, Type>::type& boost::icl::operator+=(Type&, const OperandT&)
operator += (Type& object, const OperandT& operand)
^~~~~~~~
/ext-lib/include/boost/icl/concept/interval_associator.hpp:303:1: note: template argument deduction/substitution failed:
/ext-lib/include/boost/icl/concept/interval_associator.hpp: In substitution of ‘template<class Type, class OperandT> typename boost::enable_if<boost::icl::is_intra_derivative<Type, AssociateT>, Type>::type& boost::icl::operator+=(Type&, const OperandT&) [with Type = std::shared_ptr<const std::__cxx11::basic_string<char> >; OperandT = std::shared_ptr<const std::__cxx11::basic_string<char> >]’:
/ext-lib/include/boost/icl/functors.hpp:73:18: required from ‘void boost::icl::inplace_plus<Type>::operator()(Type&, const Type&) const [with Type = std::shared_ptr<const std::__cxx11::basic_string<char> >]’
/ext-lib/include/boost/icl/interval_base_map.hpp:898:19: required from ‘void boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::add_rear(const interval_type&, const CodomainT&, boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator&) [with Combiner = boost::icl::inplace_plus<std::shared_ptr<const std::__cxx11::basic_string<char> > >; SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::interval_type = boost::icl::discrete_interval<int, std::less>; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > > >]’
/ext-lib/include/boost/icl/interval_base_map.hpp:968:27: required from ‘boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::_add(const segment_type&) [with Combiner = boost::icl::inplace_plus<std::shared_ptr<const std::__cxx11::basic_string<char> > >; SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > > >; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/interval_base_map.hpp:315:9: required from ‘SubType& boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::add(const segment_type&) [with SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/concept/interval_map.hpp:149:30: required from ‘typename boost::enable_if<boost::icl::is_interval_map<Type>, Type>::type& boost::icl::add(Type&, const typename Type::segment_type&) [with Type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename boost::enable_if<boost::icl::is_interval_map<Type>, Type>::type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename Type::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/concept/interval_associator.hpp:305:20: required from ‘typename boost::enable_if<boost::icl::is_intra_derivative<Type, AssociateT>, Type>::type& boost::icl::operator+=(Type&, const OperandT&) [with Type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; OperandT = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename boost::enable_if<boost::icl::is_intra_derivative<Type, AssociateT>, Type>::type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/home/user/SourceFile.cpp:96:68: required from here
/ext-lib/include/boost/icl/concept/interval_associator.hpp:303:1: error: no type named ‘type’ in ‘struct boost::enable_if<boost::icl::is_intra_derivative<std::shared_ptr<const std::__cxx11::basic_string<char> >, std::shared_ptr<const std::__cxx11::basic_string<char> > >, std::shared_ptr<const std::__cxx11::basic_string<char> > >’
In file included from /ext-lib/include/boost/icl/associative_interval_container.hpp:18:0,
from /ext-lib/include/boost/icl/interval_base_set.hpp:24,
from /ext-lib/include/boost/icl/interval_set.hpp:14,
from /ext-lib/include/boost/icl/interval_map.hpp:13,
from /home/user/SourceFile.cpp:1:
/ext-lib/include/boost/icl/functors.hpp: In instantiation of ‘void boost::icl::inplace_plus<Type>::operator()(Type&, const Type&) const [with Type = std::shared_ptr<const std::__cxx11::basic_string<char> >]’:
/ext-lib/include/boost/icl/interval_base_map.hpp:898:19: required from ‘void boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::add_rear(const interval_type&, const CodomainT&, boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator&) [with Combiner = boost::icl::inplace_plus<std::shared_ptr<const std::__cxx11::basic_string<char> > >; SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::interval_type = boost::icl::discrete_interval<int, std::less>; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > > >]’
/ext-lib/include/boost/icl/interval_base_map.hpp:968:27: required from ‘boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::_add(const segment_type&) [with Combiner = boost::icl::inplace_plus<std::shared_ptr<const std::__cxx11::basic_string<char> > >; SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > > >; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/interval_base_map.hpp:315:9: required from ‘SubType& boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::add(const segment_type&) [with SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/concept/interval_map.hpp:149:30: required from ‘typename boost::enable_if<boost::icl::is_interval_map<Type>, Type>::type& boost::icl::add(Type&, const typename Type::segment_type&) [with Type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename boost::enable_if<boost::icl::is_interval_map<Type>, Type>::type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename Type::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/concept/interval_associator.hpp:305:20: required from ‘typename boost::enable_if<boost::icl::is_intra_derivative<Type, AssociateT>, Type>::type& boost::icl::operator+=(Type&, const OperandT&) [with Type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; OperandT = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename boost::enable_if<boost::icl::is_intra_derivative<Type, AssociateT>, Type>::type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/home/user/SourceFile.cpp:96:68: required from here
/ext-lib/include/boost/icl/concept/interval_associator.hpp:318:1: note: candidate: template<class Type, class OperandT> typename boost::enable_if<boost::icl::is_intra_combinable<LeftT, RightT>, Type>::type& boost::icl::operator+=(Type&, const OperandT&)
operator += (Type& object, const OperandT& operand)
^~~~~~~~
... more "template argument deduction/substitution failed" errors ...
/ext-lib/include/boost/icl/concept/element_associator.hpp:192:1: note: template argument deduction/substitution failed:
/ext-lib/include/boost/icl/concept/element_associator.hpp: In substitution of ‘template<class Type> typename boost::enable_if<boost::icl::is_associative_element_container<Type>, Type>::type& boost::icl::operator+=(Type&, const Type&) [with Type = std::shared_ptr<const std::__cxx11::basic_string<char> >]’:
/ext-lib/include/boost/icl/functors.hpp:73:18: required from ‘void boost::icl::inplace_plus<Type>::operator()(Type&, const Type&) const [with Type = std::shared_ptr<const std::__cxx11::basic_string<char> >]’
/ext-lib/include/boost/icl/interval_base_map.hpp:898:19: required from ‘void boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::add_rear(const interval_type&, const CodomainT&, boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator&) [with Combiner = boost::icl::inplace_plus<std::shared_ptr<const std::__cxx11::basic_string<char> > >; SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::interval_type = boost::icl::discrete_interval<int, std::less>; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > > >]’
/ext-lib/include/boost/icl/interval_base_map.hpp:968:27: required from ‘boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::_add(const segment_type&) [with Combiner = boost::icl::inplace_plus<std::shared_ptr<const std::__cxx11::basic_string<char> > >; SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > > >; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/interval_base_map.hpp:315:9: required from ‘SubType& boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::add(const segment_type&) [with SubType = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; DomainT = int; CodomainT = std::shared_ptr<const std::__cxx11::basic_string<char> >; Traits = boost::icl::partial_absorber; Compare = std::less; Combine = boost::icl::inplace_plus; Section = boost::icl::inter_section; Interval = boost::icl::discrete_interval<int, std::less>; Alloc = std::allocator; boost::icl::interval_base_map<SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc>::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/concept/interval_map.hpp:149:30: required from ‘typename boost::enable_if<boost::icl::is_interval_map<Type>, Type>::type& boost::icl::add(Type&, const typename Type::segment_type&) [with Type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename boost::enable_if<boost::icl::is_interval_map<Type>, Type>::type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename Type::segment_type = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/ext-lib/include/boost/icl/concept/interval_associator.hpp:305:20: required from ‘typename boost::enable_if<boost::icl::is_intra_derivative<Type, AssociateT>, Type>::type& boost::icl::operator+=(Type&, const OperandT&) [with Type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >; OperandT = std::pair<boost::icl::discrete_interval<int, std::less>, std::shared_ptr<const std::__cxx11::basic_string<char> > >; typename boost::enable_if<boost::icl::is_intra_derivative<Type, AssociateT>, Type>::type = boost::icl::interval_map<int, std::shared_ptr<const std::__cxx11::basic_string<char> > >]’
/home/user/SourceFile.cpp:96:68: required from here
/ext-lib/include/boost/icl/concept/element_associator.hpp:192:1: error: no type named ‘type’ in ‘struct boost::enable_if<boost::icl::is_associative_element_container<std::shared_ptr<const std::__cxx11::basic_string<char> > >, std::shared_ptr<const std::__cxx11::basic_string<char> > >’
答案 0 :(得分:1)
在&#34; Overlapate on Overlap&#34;在the documentation中,它指出映射到的类型需要支持set union。
工作版本:
namespace icl = boost::icl;
using setOfPointers = std::set<std::shared_ptr<const std::string>>;
icl::interval_map<int, setOfPointers> party;
const auto mary = setOfPointers{std::make_shared<const std::string>("Mary")};
party += make_pair(icl::interval<int>::right_open(10, 16), mary);