I need to write some code for a MFC project, but I don’t know how to get required code to work when using MFC.
I prototyped my function first just using the STL types, and boost.
STL Prototype
#include <string>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/find.hpp>
void ProtoTest()
{
std::string sText("123Hello4");
boost::iterator_range<std::string::iterator> nc_result = find_token(sText, boost::algorithm::is_alpha(), boost::algorithm ::token_compress_on);
}
Result = “Hello”
I eventually managed to get it working with MFC, however I had to supply two typedefs. I would like to do it in one, however there isn’t much documentation on using the MFC port provided in boost.
#include "stdafx.h"
#include <boost\range\atl.hpp>
void Test()
{
typedef boost::range_iterator<CString>::type CString_it;
typedef boost::iterator_range<CString_it> CString_range;
CString strText("123Hello4");
CString_range r;
r = find_token(text, boost::algorithm::is_alpha(), boost::algorithm ::token_compress_on);
}
Again Result = “Hello”
Is there a single typedef I can use to hold the result of find_token, rather than needing two typdefs to achieve it.
You could just combine them
But I don’t know if that is an advantage.