gpt4 book ai didi

c++ - 为什么这个可变参数函数调用不明确?

转载 作者:太空宇宙 更新时间:2023-11-04 15:17:51 26 4
gpt4 key购买 nike

<分区>

  template<typename FilterComponent, typename ...FilterComponents>
std::bitset<components_count> component_impl(std::bitset<components_count> &b){
b.set(FilterComponent::get_id());
return component_impl<FilterComponents...>(b); //ambiguous
}
template<typename FilterComponent>
std::bitset<components_count> component_impl(std::bitset<components_count> &b){
b.set(FilterComponent::get_id());
return b;
}
template<typename ...FilterComponents>
std::bitset<components_count> component_mask(){
std::bitset<components_count> b;
component_impl<FilterComponents...>(b);
return b;
}

为什么这个函数调用不明确?我想这样调用它 component_mask<Foo,Bar,Baz>();

error: call to member function 'component_impl' is ambiguous
return component_impl<FilterComponents...>(b);

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