Created
November 27, 2011 03:45
-
-
Save metagoto/1396923 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/iterator/transform_iterator.hpp> | |
#include <boost/filesystem.hpp> | |
struct iterator | |
: public std::unary_function<char const*, boost::filesystem3::directory_entry const&> | |
{ | |
char const* operator()(boost::filesystem3::directory_entry const& p) const | |
{ | |
return p.path().c_str(); | |
} | |
}; | |
int main(int argc, char* argv[]) | |
{ | |
using namespace boost::filesystem3; | |
typedef boost::transform_iterator<iterator, directory_iterator, char const*> it_t; | |
const path p = "/tmp"; | |
copy(it_t(directory_iterator(p)), it_t(directory_iterator()) | |
,std::ostream_iterator<char const*>(std::cout, "\n")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment