Boost logo

Boost Users :

Subject: Re: [Boost-users] Program Options of Filesystem Path's - confused!
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2010-08-16 17:58:03



> >        lexical_cast<fs::wpath>(fs::wpath("the path that fails"))

Making the string literal a L-string (L"the path that fails"), it won't compile. The spiel is attached at the end of this message.

> >
> > If that fails, it means operator>> is mishandling spaces in paths.
>
> lexical_cast<fs::wpath>("the path that fails")
>

Correcting to make the string L, it throws an exception "bad lexical cast: source type value could not be interpreted as target"

You ask if it's version 2 or version 3 of the fs library:
It doesn't say! However, the href for the docs says "this is version 2", which was "default for Boost 1.44 only". But I have Boost 1.43. The headers don't show version numbers, but do show a date of 2005. Should I move to version 3? I guess Boost 1.44 is hot off the press so it's normal enough that I don't have it?

===


Compiler output for line 13 which is
        fs::wpath p1= lexical_cast<fs::wpath>(fs::wpath(L"the first path that fails"));

Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

fs_test.cpp
D:\boost_1_43_0\boost\lexical_cast.hpp(595) : error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'const src' (or there is no acceptable conversion)
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(653): could be 'std::basic_ostream<_Elem,_Traits> &std::operator <<<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const char *)' [found using argument-dependent lookup]
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(700): or 'std::basic_ostream<_Elem,_Traits> &std::operator <<<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,char)' [found using argument-dependent lookup]
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(738): or 'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const char *)' [found using argument-dependent lookup]
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(785): or 'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,char)' [found using argument-dependent lookup]
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(909): or 'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const signed char *)' [found using argument-dependent lookup]
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(916): or 'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,signed char)' [found using argument-dependent lookup]
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(923): or 'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const unsigned char *)' [found using argument-dependent lookup]
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(930): or 'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,unsigned char)' [found using argument-dependent lookup]
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        D:\boost_1_43_0\boost/filesystem/path.hpp(584): or 'std::basic_ostream<_Elem,_Traits> &boost::filesystem::operator <<<T>(std::basic_ostream<_Elem,_Traits> &,const Path &)' [found using argument-dependent lookup]
        with
        [
            _Elem=wchar_t,
            _Traits=std::char_traits<wchar_t>,
            T=src,
            Path=src
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(170): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::basic_ostream<_Elem,_Traits> &(__cdecl *)(std::basic_ostream<_Elem,_Traits> &))'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(176): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::basic_ios<_Elem,_Traits> &(__cdecl *)(std::basic_ios<_Elem,_Traits> &))'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(183): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::ios_base &(__cdecl *)(std::ios_base &))'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(190): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::_Bool)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(210): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(short)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(243): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(unsigned short)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(263): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(int)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(288): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(unsigned int)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(308): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(long)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(328): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(unsigned long)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(349): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(__int64)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(369): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(unsigned __int64)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(390): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(float)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(410): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(double)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(430): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(long double)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(450): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(const void *)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\ostream(470): or 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::basic_streambuf<_Elem,_Traits> *)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
        while trying to match the argument list '(std::basic_stringstream<_Elem,_Traits,_Alloc>, const src)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Alloc=std::allocator<char>
        ]
        D:\boost_1_43_0\boost\lexical_cast.hpp(594) : while compiling class template member function 'bool boost::detail::lexical_stream<Target,Source,Traits>::operator <<(const Source &)'
        with
        [
            Target=boost::filesystem::wpath,
            Source=src,
            Traits=traits
        ]
        D:\boost_1_43_0\boost\lexical_cast.hpp(1148) : see reference to class template instantiation 'boost::detail::lexical_stream<Target,Source,Traits>' being compiled
        with
        [
            Target=boost::filesystem::wpath,
            Source=src,
            Traits=traits
        ]
        D:\boost_1_43_0\boost\lexical_cast.hpp(1174) : see reference to function template instantiation 'Target boost::detail::lexical_cast<Target,src,true,char_type>(const boost::filesystem::basic_path<String,Traits> &,CharT *,size_t)' being compiled
        with
        [
            Target=boost::filesystem::wpath,
            String=std::wstring,
            Traits=boost::filesystem::wpath_traits,
            CharT=char_type
        ]
        fs_test.cpp(13) : see reference to function template instantiation 'Target boost::lexical_cast<boost::filesystem::wpath,boost::filesystem::basic_path<String,Traits>>(const Source &)' being compiled
        with
        [
            Target=boost::filesystem::wpath,
            String=std::wstring,
            Traits=boost::filesystem::wpath_traits,
            Source=boost::filesystem::basic_path<std::wstring,boost::filesystem::wpath_traits>
        ]
D:\boost_1_43_0\boost\lexical_cast.hpp(595) : error C2228: left of '.fail' must have class/struct/union






=== stupid corporate footer===

TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net