[tuple] Function object for nth element of a tuple
Is there a standard way to get a function object that extracts a fixed element from a tuple? There is a boost::tuples::detail::get_class<N> that does what I want, but it does not have result_type and does not appear to be officially supported. -- Jeremiah Willcock
Jeremiah Willcock wrote:
Is there a standard way to get a function object that extracts a fixed element from a tuple? There is a boost::tuples::detail::get_class<N> that does what I want, but it does not have result_type and does not appear to be officially supported. isn't boost::fusion::at_c a proper PFO that works on tuple ?
-- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
On Sun, 5 Jul 2009, joel wrote:
Jeremiah Willcock wrote:
Is there a standard way to get a function object that extracts a fixed element from a tuple? There is a boost::tuples::detail::get_class<N> that does what I want, but it does not have result_type and does not appear to be officially supported. isn't boost::fusion::at_c a proper PFO that works on tuple ?
Do you mean
Jeremiah Willcock wrote:
That does not appear to be a function object, but a plain function. Also, shouldn't something like this (and getting the nth element type from a tuple) be in the tuple library itself? More like : http://www.boost.org/doc/libs/1_39_0/libs/fusion/doc/html/fusion/sequence/in... and : http://www.boost.org/doc/libs/1_39_0/libs/fusion/doc/html/fusion/sequence/in...
But a quick look at the implementation, it's not a PFO even if it supports the result_of protocol. -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
On Sun, 5 Jul 2009, joel wrote:
Jeremiah Willcock wrote:
That does not appear to be a function object, but a plain function. Also, shouldn't something like this (and getting the nth element type from a tuple) be in the tuple library itself? More like : http://www.boost.org/doc/libs/1_39_0/libs/fusion/doc/html/fusion/sequence/in... and : http://www.boost.org/doc/libs/1_39_0/libs/fusion/doc/html/fusion/sequence/in...
But a quick look at the implementation, it's not a PFO even if it supports the result_of protocol.
I wanted something that would be a particular class, not a function object, for efficiency reasons. I ended up writing my own, but can still replace it if get_class is fixed up. It would be good to have it in 1.40 so I can fix my code in 1.40 that uses it. -- Jeremiah Willcock
Jeremiah Willcock wrote:
I wanted something that would be a particular class, not a function object, for efficiency reasons. I don't follow you here. A polymorphic function object is a mere functor supporting result_of protocol. No efficiency penalty arise using them.
-- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
I wanted something that would be a particular class, not a function object, for efficiency reasons. I don't follow you here. A polymorphic function object is a mere functor supporting result_of protocol. No efficiency penalty arise using them.
That's what I meant -- a function object (polymorphic or not), not a function template. -- Jeremiah Willcock
participants (2)
-
Jeremiah Willcock
-
joel