i am trying to iterate over a directory using Boost.Filesystem library.
The problem is that when i try to instantiate a path object, i get an std::length_error with the message "string too long" with strings of any length, even for example "pippo".
I have already tried all of these:
string s = "pippo";
path p(s);
path p(s.begin(), s.end());
path p(s.c_str());
path p("pippo");
I am on windows 7 with boost precompiled version 1.47 for vc++10.
Thank you in advance, Luca
EDIT
this is the boost code executed (path.hpp line 129)
template <class Source>
path(Source const& source,
typename boost::enable_if<path_traits::is_pathable<
typename boost::decay<Source>::type> >::type* =0)
{
path_traits::dispatch(source, m_pathname, codecvt());
}
and the error is thrown from (path_traits.hpp line 174)
template <class U> inline
void dispatch(const std::string& c, U& to, const codecvt_type& cvt)
{
if (c.size())
convert(&*c.begin(), &*c.begin() + c.size(), to, cvt);
}
the function that throws is "convert". From the debugger i saw that both
&*c.begin()
and
&*c.begin() + c.size()
are correctly executed