
On Thu, May 12, 2011 at 9:05 AM, lcaminiti <lorcaminiti@gmail.com> wrote:
Jeffrey Lee Hellrung, Jr.-2 wrote:
On Fri, May 6, 2011 at 7:59 PM, Lorenzo Caminiti <lorcaminiti@gmail.com>wrote:
On Fri, May 6, 2011 at 2:07 PM, Lorenzo Caminiti <lorcaminiti@gmail.com> wrote:
On Fri, May 6, 2011 at 1:32 PM, Jeffrey Lee Hellrung, Jr. <jeffrey.hellrung@gmail.com> wrote:
Would "const bind(int)& x" work?
It think yes :) I should be able to support the syntax (also with optional leading const and optional &):
bind& x // deduced type (with Boost.Typeof) bind(int)& x // specify type (no Boost.Typeof)
More in general "[const] bind [(type)] [&] name" where "[t]" indicates that token t is optional.
[...snip preprocessor details...]
Awesome.
I have implemented this:
http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local...
Great! Looks like a typo in the 4th bind use case: const bind(variable-type)& variable-name // Bind by constant value with explicit type. Should be "...by reference-to-const..." or "...by constant reference..." (depending on how you refer to such references throughout the documentation), eh?
#include <boost/local/function.hpp> #include <boost/local/block.hpp> #include <boost/local/exit.hpp> #include <vector> #include <algorithm> #include <iostream> #include <sstream> #include <cassert>
class adder { public: adder(): sum_(0.0) {}
double sum(const std::vector<double>& nums, const int& factor = 10) { std::ostringstream out;
void BOOST_LOCAL_FUNCTION_PARAMS(double num, const bind(const int&) factor, // Specify bind types bind(std::ostringstream)& out, // explicitly (so no
I would infer from this and the documentation that const bind(const int&) factor // outer const superfluous??? bind(const int&) factor const bind(const int)& factor // outer const superfluous??? bind(const int)& factor const bind(int)& factor bind(const int&) const factor // outer const superfluous??? bind(int) const & factor are all equivalent, but I'm not sure. Can you please clarify in the documentation? [...snip rest of example...] - Jeff