Click here to Skip to main content
12,505,104 members (58,870 online)
Click here to Skip to main content

Stats

43.2K views
370 downloads
17 bookmarked
Posted

Win32 File Name Iteration Boost Way

, 3 Nov 2005 CPOL
A Port of ::FindFirstFile to Boost.Range and Boost.Foreach
#pragma once

#include <functional> // for std::unary_function
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>

namespace find_file {

template< class Sequence >
struct find_file_construct :
	std::unary_function<WIN32_FIND_DATA, Sequence>
{
	Sequence operator()(WIN32_FIND_DATA const& data) const
	{
		return Sequence(boost::begin(data.cFileName), boost::end(data.cFileName));
	}
};

template< class StringT >
struct find_file_stringize :
	std::unary_function<WIN32_FIND_DATA, StringT>
{
	StringT operator()(WIN32_FIND_DATA const& data) const
	{
		return StringT(data.cFileName);
	}
};

} // namespace find_file

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

mb2sync
Japan Japan
I am worried about my poor English...

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160919.1 | Last Updated 4 Nov 2005
Article Copyright 2005 by mb2sync
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid