hello.
Is there macro, something like BOOST_AUTO, which would allow to emulate automatic return type deduction of function in C++?
I mean something like trailing-return-type, http://en.wikipedia.org/wiki/C%2B%2B0x#Alternative_function_syntax
this is what I have:
using namespace boost::fusion;
#define AS_VECTOR(var, expr) BOOST_AUTO(var, as_vector(expr))
AS_VECTOR(b, erase(arguments, advance_c<N>(begin(arguments))));
AS_VECTOR(a, insert_range(b, advance_c<N>(begin(b)), vector_tie(i)));
while (i < upper()(a))
{
//apply<T>(*this, f, a);
++i;
}
#undef AS_VECTOR
instantiation of erase and insert_range creates really crazy templates. So I was wondering it's possible to replace macro AS_VECTOR with function, but not having to declare return type.
complete source code is here: http://stackoverflow.com/questions/2898870/syntax-to-express-mathematical-formula-concisely-in-your-language-of-choice/2939922#2939922
basically, in the above snippet, and in the definition of operator in the link above, I would ideally like to infer return type from function/operator body (since it's single-line only). I tried using BOOST_TYPEOF, however generally, I do not have control how parameters are instantiated, so that does not work.
for example, the above two macro snippet is really replace_at
. trying to make it into a stand-alone function results in return parameter which is like 6-7 templates deep.
Doable, but very messy.
If it is not something that can be implemented, it's no big deal. right now I get by with macros, so if nothing else, I will just keep using them.
thank you