Click here to Skip to main content
13,097,012 members (37,965 online)
Click here to Skip to main content

Stats

46.4K views
17 bookmarked
Posted 3 Nov 2005

Win32 File Name Iteration Boost Way

, 3 Nov 2005
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...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.170813.1 | Last Updated 4 Nov 2005
Article Copyright 2005 by mb2sync
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid