
I lost my copy of metaprogramming. I'm ordering another tomorrow. But here is what I'm up to. I've been doing the virtual path thing with old MFC classes and such, like: C:\\cpp\\RA_User_2_2\\$(TEST) or $(PATH)\$(TEST) etc. What I'm trying to do is derive from filesystem and wrap this virtual stuff around it to break away from the old stuff I have, (ugly stuff). I've gotten to the point where I'd like to snap different virtual sets in and don't want to build on the old stuff, filesystem is really cool. I have a client that has several clients and wants to set his configurations on the fly to handle them, I do it in code for myself, but it is not runtime. Anyway... So I started with: template<class String, class Traits> class basic_vpath; typedef basic_vpath< std::string, path_traits > vpath; template<class String, class Traits> class basic_vpath :public basic_path< String, Traits > { }; But I don't understand why I can just fine: CString strUserDirectory= _T("C:\\cpp\\RA_User_2_2\\$(TEST)"); path aPath( strUserDirectory ); But can't convert from CString, or even std::string with: CString strUserDirectory= _T("C:\\cpp\\RA_User_2_2\\$(TEST)"); vpath aPath( strUserDirectory ); I'm trying to extend what I see in path.hpp without success, and I've tried lots of stuff. Something to do with the converters? Thanks, Dan.

template<class String, class Traits> class basic_vpath; typedef basic_vpath< std::string, path_traits > vpath;
template<class String, class Traits> class basic_vpath :public basic_path< String, Traits > { };
But I don't understand why I can just fine: CString strUserDirectory= _T("C:\\cpp\\RA_User_2_2\\$(TEST)"); path aPath( strUserDirectory );
But can't convert from CString, or even std::string with:
CString strUserDirectory= _T("C:\\cpp\\RA_User_2_2\\$(TEST)"); vpath aPath( strUserDirectory );
Does vpath class have a constructor that takes CString or LPTCSTR?

Igor R wrote:
template<class String, class Traits> class basic_vpath; typedef basic_vpath< std::string, path_traits> vpath;
template<class String, class Traits> class basic_vpath :public basic_path< String, Traits> { };
But I don't understand why I can just fine: CString strUserDirectory= _T("C:\\cpp\\RA_User_2_2\\$(TEST)"); path aPath( strUserDirectory );
But can't convert from CString, or even std::string with:
CString strUserDirectory= _T("C:\\cpp\\RA_User_2_2\\$(TEST)"); vpath aPath( strUserDirectory );
Does vpath class have a constructor that takes CString or LPTCSTR?
Hi, From what I see, basic_path will with < std::string, path_traits > ( from path.hpp). I'm deriving from basic_path and using that constructor. This line 'looks' to work fine for path: typedef basic_path< std::string, path_traits > path; But I get the error: 'basic_vpath<String,Traits>::basic_vpath(const basic_vpath<String,Traits> &)' : cannot convert parameter 1 from 'CString' to 'const basic_vpath<String,Traits> &' When I add my extension above. I'd like this vpath class to have all the functionallity of path. The added stuff would kick in on a signature of $(..) in the path. Best, Dan. .

Igor R wrote:
From what I see, basic_path will with< std::string, path_traits> ( from path.hpp). I'm deriving from basic_path and using that constructor.
I don't know what you mean by saying "using that constructor", but note that in C++ constructors are not inherited.
Thanks Igor, I guess I need a good head slap. The error was cryptic. This works: template<class String, class Traits> class basic_vpath :public basic_path< String, Traits > { public: basic_vpath( const string_type & s ) :basic_path( s ) { } basic_vpath( const value_type * s ) :basic_path( s ) { } }; Best, Dan.
participants (2)
-
Dan Bloomquist
-
Igor R