[C++-sig] variable # args?

Neal Becker ndbecker2 at gmail.com
Wed Feb 1 04:07:25 CET 2006


How do I create a function in c++ that appears to python as a function
taking a variable #args?

What I'm doing now is like:

F (object& o) {
  int size = extract<long> (o.attr ("__len__")());

   for (int i = 0; i < size; ++i) {
    const out_t& v = extract<out_t&> (o[i]);
 ...

This works for passing a single object that is a sequence, e.g., tuple:

F ((a,b,c))

But what I really want is

F (a,b,c)
 




More information about the Cplusplus-sig mailing list