|
Boost Users : |
Subject: [Boost-users] Emplace for Boost heaps
From: Rob Patro (rob.patro_at_[hidden])
Date: 2013-02-27 17:02:05
Hi,
I'm trying to use the emplace function for the Boost heaps. I've come up
with a minimal example (attached), but when I compile it I get the
following error:
In file included from testpq.cpp:1:0:
>
> /opt/local/include/boost/heap/skew_heap.hpp: In instantiation of
>> 'boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::node_pointer
>> boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5,
>> A6>::emplace_internal(Args&& ...) [with Args = {int, int}; T = thing; A0 =
>> boost::heap::compare<cmpthings>; A1 = boost::parameter::void_; A2 =
>> boost::parameter::void_; A3 = boost::parameter::void_; A4 =
>> boost::parameter::void_; A5 = boost::parameter::void_; A6 =
>> boost::parameter::void_; boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5,
>> A6>::node_pointer = boost::heap::detail::skew_heap_node<thing, false>*]':
>
> /opt/local/include/boost/heap/skew_heap.hpp:769:13: required from
>> 'static void boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5,
>> A6>::push_void::emplace(boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5,
>> A6>*, Args&& ...) [with Args = {int, int}; T = thing; A0 =
>> boost::heap::compare<cmpthings>; A1 = boost::parameter::void_; A2 =
>> boost::parameter::void_; A3 = boost::parameter::void_; A4 =
>> boost::parameter::void_; A5 = boost::parameter::void_; A6 =
>> boost::parameter::void_; boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5,
>> A6> = boost::heap::skew_heap<thing, boost::heap::compare<cmpthings> >]'
>
> /opt/local/include/boost/heap/skew_heap.hpp:437:70: required from
>> 'typename boost::mpl::if_c<boost::heap::skew_heap<T, A0, A1, A2, A3, A4,
>> A5, A6>::is_mutable, typename boost::mpl::if_c<boost::heap::skew_heap<T,
>> A0, A1, A2, A3, A4, A5, A6>::is_mutable, typename boost::heap::skew_heap<T,
>> A0, A1, A2, A3, A4, A5, A6>::implementation_defined::handle_type,
>> void*>::type, void>::type boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5,
>> A6>::emplace(Args&& ...) [with Args = {int, int}; T = thing; A0 =
>> boost::heap::compare<cmpthings>; A1 = boost::parameter::void_; A2 =
>> boost::parameter::void_; A3 = boost::parameter::void_; A4 =
>> boost::parameter::void_; A5 = boost::parameter::void_; A6 =
>> boost::parameter::void_; typename
>> boost::mpl::if_c<boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5,
>> A6>::is_mutable, typename boost::mpl::if_c<boost::heap::skew_heap<T, A0,
>> A1, A2, A3, A4, A5, A6>::is_mutable, typename boost::heap::skew_heap<T, A0,
>> A1, A2, A3, A4, A5, A6>::implementation_defined::handle_type, void*>::type,
>> void>::type = void]'
>
> testpq.cpp:27:20: required from here
>
> /opt/local/include/boost/heap/skew_heap.hpp:808:9: error: no matching
>> function for call to 'boost::heap::skew_heap<thing,
>> boost::heap::compare<cmpthings> >::make_node(int, int)'
>
> /opt/local/include/boost/heap/skew_heap.hpp:808:9: note: candidates are:
>
> In file included from /opt/local/include/boost/heap/skew_heap.hpp:21:0,
>
> from testpq.cpp:1:
>
> /opt/local/include/boost/heap/detail/stable_heap.hpp:189:19: note:
>> boost::heap::detail::heap_base<T, Cmp, constant_time_size,
>> StabilityCounterType, stable>::internal_type
>> boost::heap::detail::heap_base<T, Cmp, constant_time_size,
>> StabilityCounterType, stable>::make_node(const T&) [with T = thing; Cmp =
>> cmpthings; bool constant_time_size = true; StabilityCounterType = long
>> unsigned int; bool stable = false; boost::heap::detail::heap_base<T, Cmp,
>> constant_time_size, StabilityCounterType, stable>::internal_type = thing]
>
> /opt/local/include/boost/heap/detail/stable_heap.hpp:189:19: note:
>> candidate expects 1 argument, 2 provided
>
> /opt/local/include/boost/heap/detail/stable_heap.hpp:195:10: note: T&&
>> boost::heap::detail::heap_base<T, Cmp, constant_time_size,
>> StabilityCounterType, stable>::make_node(T&&) [with T = thing; Cmp =
>> cmpthings; bool constant_time_size = true; StabilityCounterType = long
>> unsigned int; bool stable = false]
>
> /opt/local/include/boost/heap/detail/stable_heap.hpp:195:10: note:
>> candidate expects 1 argument, 2 provided
>
>
It seems that something is amiss with the perfect forwarding (or I'm
somehow using emplace incorrectly). Either way, any help getting this to
work or figuring out why it doesn't would be greatly appreciated.
Thanks,
Rob
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net