From 1036211658081256520
X-Google-Thread: 109fba,4a997c219a86e9e9,start
X-Google-Thread: f78e5,4a997c219a86e9e9,start
X-Google-Attributes: gid109fba,gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news3.google.com!news.glorb.com!news.alt.net!comp-std-cpp-robomod!not-for-mail
From: "Henrique A. Menarin" <hamenarin@gmail.com>
Newsgroups: comp.lang.c++,comp.std.c++
Subject: Boost algorithm ll::accumulate question
Date: Sat, 27 Jan 2007 21:55:21 CST
Organization: http://groups.google.com
Lines: 30
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <1169906041.610594.260620@k78g2000cwa.googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1169906047 4082 127.0.0.1 (27 Jan 2007 13:54:07 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 27 Jan 2007 13:54:07 +0000 (UTC)
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: k78g2000cwa.googlegroups.com; posting-host=201.24.67.250;
   posting-account=FZCX3Q0AAACoeanSMj8WiWbsRz0t-NA3
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Xref: g2news2.google.com comp.lang.c++:76151 comp.std.c++:5465

I want to create a function _and so that I could write

vector<bool> asserts;
//...
bool b = _and(asserts);

and it "anded" all the elements in the vector. I implemented it like 
this:


using namespace boost::lambda;

boost::function(bool (vector<boost>)) _and;
_and = bind(ll::accumulate(),
                  bind(call_begin(), _1),
                  bind(call_end(), _1),
                  true,
                  protect(_1 && _2));

But there is an error with the lambda function protect(_1 && _2).
Does anyone knows what is wrong in this expression?
This syntax is valid for creating similar functions for adding and 
multiplying numbers.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



