|
Boost Users : |
From: Scott Meyers (usenet_at_[hidden])
Date: 2006-03-08 17:56:06
I tried both suggested solutions (applying var to cout, applying constant to the
output string -- see below), but neither works. What follows is a complete
compilation unit (not program -- there's no main) that fails with both VC7.1 and
gcc 3.4.2 when I uncomment either of the two for_each loops. The error messages
are, um, not as enlightening as they might be. Any suggestions how to get this
to work?
Thanks,
Scott
#include <iostream>
#include <string>
#include "boost/filesystem/operations.hpp"
#include "boost/filesystem/path.hpp"
#include "boost/lambda/bind.hpp"
#include "boost/lambda/if.hpp"
void f(const std::string& dirName)
{
using namespace std;
namespace fs = boost::filesystem;
fs::path dir(dirName, fs::native);
using namespace boost::lambda;
// for_each(fs::directory_iterator(dir), fs::directory_iterator(),
// if_then_else(bind(&fs::is_directory, _1),
// cout << constant("D\n"),
// cout << constant("~D\n")));
// for_each(fs::directory_iterator(dir), fs::directory_iterator(),
// if_then_else(bind(&fs::is_directory, _1),
// var(cout) << "D\n",
// var(cout) << "~D\n"));
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net