Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

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)

About the Author

mb2sync

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 4 Nov 2005
Article Copyright 2005 by mb2sync
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid