Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2007-11-27 11:14:10


Joseph Gauterin <joseph.gauterin <at> googlemail.com> writes:

>
> What's the advantage to using
> int BOOST_LOCAL_FUNCTION(char c)
> {
> std::cout << c << '\n';
> return 1;
> } BOOST_LOCAL_FUNCTION_DECL(a)
>
> over:
>
> struct
> {
> int operator()(char c)const
> {
> std::cout << c << '\n';
> return 1;
> }
> } a;

Local struct can't be passed to templates:

boost::function<int(char)> f = a;

error: conversion from `main()::<anonymous struct>' to non-scalar type
`boost::function<int ()(char), std::allocator<void> >' requested

--
Alexander

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk