|
#pragma once
// See:
// boost/range/detail/mfc/cstring.hpp
// http://aspn.activestate.com/ASPN/Mail/Message/boost/2804138
#include <cstddef>
#include <atlmisc.h>
#include <boost/config.hpp>
#include "../range/range_metafunctions_fwd.hpp"
// Workaround: warning C4099
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
#define TOMATO_class class
#else
#define TOMATO_class struct
#endif
namespace boost {
// metafunctions
// range_iterator
template< >
TOMATO_class range_iterator< WTL::CString >
{
typedef TCHAR *type;
};
template< >
TOMATO_class range_iterator< WTL::CString const > : public
range_iterator< WTL::CString >
{
};
// range_const_iterator
template< >
TOMATO_class range_const_iterator< WTL::CString >
{
typedef TCHAR const *type;
};
template< >
TOMATO_class range_const_iterator< WTL::CString const > : public
range_const_iterator< WTL::CString >
{
};
// range_difference
template< >
TOMATO_class range_difference< WTL::CString >
{
typedef std::ptrdiff_t type;
};
template< >
TOMATO_class range_difference< WTL::CString const > : public
range_difference< WTL::CString >
{
};
// range_size
template< >
TOMATO_class range_size< WTL::CString >
{
typedef int type;
};
template< >
TOMATO_class range_size< WTL::CString const > : public
range_size< WTL::CString >
{
};
// range_value
template< >
TOMATO_class range_value< WTL::CString >
{
typedef TCHAR type;
};
template< >
TOMATO_class range_value< WTL::CString const > : public
range_value< WTL::CString >
{
};
// functions
// begin
inline
range_iterator< WTL::CString >::type
begin(WTL::CString& rng)
{
return rng.GetBuffer(0);
}
inline
range_const_iterator< WTL::CString >::type
begin(WTL::CString const& rng)
{
return rng;
}
// size
inline
range_size< WTL::CString >::type
size(WTL::CString const& rng)
{
return rng.GetLength();
}
// end
inline
range_iterator< WTL::CString >::type
end(WTL::CString& rng)
{
return begin(rng) + size(rng);
}
inline
range_const_iterator< WTL::CString >::type
end(WTL::CString const& rng)
{
return begin(rng) + size(rng);
}
// default 'empty()' ok
} // namespace boost
#undef TOMATO_class
|
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.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here