|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-10-05 15:56:32
In an attempt to improve on the interface used by the Boost.Graph
library for named parameters, I came up with the enclosed scheme,
which allows the following Python-like syntax:
int x1 = f("x", 3.14, 22);
int x2 = f(value = 3.14, name = "x");
int x3 = f(value = 6.5);
int x4 = f();
int x5 = g("x", 3.14, 22);
int x6 = g(value = 3.14, name = "x");
int x8 = g("q", index = 77);
I'm pretty proud of myself (;->) but I'm not too satisfied with how
much code is required for someone wanting to write a new function
accepting keyword arguments, and further I'm not sure how to design a
good interface for automatically generating the boilerplate with the
preprocessor. Consider that there may be initial non-keyword args,
which might themselves be templated or not.
I thought I'd open it up for suggestions. Thoughts, anyone?
Thanks,
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk