Hi, Well...I was more thinking about a SSCCE than a whole project, but anyway:
Does your compiler support the currently effective (2011) standard for C++ sufficiently? try e.g. to compile this: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///@file bind_recursion.cxx ///@author solkar http://stackoverflow.com/users/2378245/solkar ///@see http://stackoverflow.com/questions/24491402/compile-time-recursion-via-stdfunction-variadic-templates/24494430#24494430 ///@date Jul 1st, 2014 #include <functional> // bind, is_placeholder #include <exception> // runtime_error #include <iostream> #include <cmath> // M_PI #include <complex> #define VOODOO 1 #if VOODOO /** * It's rather pointless binding the N parameters * of N-ary callable to N placeholders in-sequence * * This framework will start making sense if there are * some free parameters to be bound; see HINT below. */ // placeholder template<int N> struct PH {}; // It's ugly to extend std, // but there's no other way to make arbitrary // placeholders known to std::bind namespace std { template<int N> struct is_placeholder<PH<N>> : public integral_constant<int, N> {}; } // recursive sequential binder // this simply pushes the placeholder types into the Args // result is in-order template<class F, int N, class... Args> struct SeqBinder : public SeqBinder<F, N-1, PH<N>, Args...> {}; // recursive sequential binder terminator specialization template<class F, class... Args> struct SeqBinder<F, 0, Args...> { static auto bind(F&& f) /* * HINT * here is to point to add whatever invariant params * to the bind */ -> decltype(std::bind(f, /* +whatever ,*/ Args()...)) { return std::bind(f, /* +whatever ,*/ Args()...); } // bind() }; // SeqBinder (terminator specialization) template<typename F, int N> auto seq_bind(F&& f, const PH<N>&&) -> decltype(SeqBinder<F, N>::bind(f)) { return SeqBinder<F, N>::bind(f); } // template seq_bind() #endif // #if VOODOO // no clue why gcc (4.8.2) wants a // void output(void) (see below) // for the recursive template below void output(void) { struct void_call : public std::runtime_error { void_call(const char* msg) : std::runtime_error(msg) {} }; // trace this throw void_call("void output(void) called"); } // void output(void) // recursive template template<typename T, typename... Args> void output(const T& t, const Args&... args) { std::cout << typeid(t).name() << " : " << t << std::endl; if (sizeof...(Args) > 0) // no clue why gcc (4.8.2) looks for a // void output(void) output(args...); } // template void output() // test class template < typename... Args > struct LHC { std::function<void(Args...)> cauldron; ///@TODO delete unwanted ctors LHC() : #if VOODOO cauldron(seq_bind(output<Args...>, PH<sizeof...(Args)>())) #else cauldron(output<Args...>) #endif // #if VOODOO {} void operator () (const Args&...args) const{ cauldron(args...); } }; // struct LHC template < typename... Args > void make_GUT(Args... args) { LHC<Args...> smasher; smasher(args...); } void test() { auto cminus = std::exp(std::complex<double>(0.,M_PI)); auto phone_number = 137L; make_GUT("GUT essentials: ", 42, NULL, M_PI, cminus, phone_number); } // void test() int main() { try { test(); } catch (const std::runtime_error& e) { std::cerr << e.what() << std::endl; } } // int main() /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// with both(0,1) settings for "VOODOO", and so-called C++11-"support" enabled in your compiler. I'd dislike having to publish code that is already sort-of deprecated at the time of publishing. Cheers, Solkar @moderators: How to save the "<",">" in #include <myheader> in code-tags from being parsed. I thought especially code-tags would prevent that. ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60154#60154 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org