#Gross Template Syntax question

7 messages · Page 1 of 1 (latest)

remote geyser
#

Hey folks, I have a function that looks like this:

template<typename R, class C, typename ... As>
constexpr static void TemplatedFunction(R(C::*funcPtr)(As...))

Is it possible to get TemplatedFunction to take an rvalue reference as an input? R(C::*funcPtr&&)(As...) and R(C::*funcPtr)(As...)&& do not seem to be doing the trick.

warped edgeBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

river whale
#

std::add_rvalue_reference ? I think so

remote geyser
#

Still unable to deduce the template argument from the function pointer I'm afraid

vivid sundial
#

why would you need to take a pointer to member function by reference? let alone by rvalue reference?

jolly lodge
#

^ Member references are constants. No need for reference or r-value as they won't change at runtime. The pointer semantics is more to differentiate from calls/references to the value.

#

Although actually if the reference would be coming from a variable, that variable can change at runtime so taking a pointer/reference to that could make sense to use the updated value down the line, however I struggle to see what uses-case that would have. But also no point in r-value as member references are just numbers at runtime and not structures.