[Filesystem] path as an STL container or replacement possible?

Hi! namespace fs = boost::filesystem; I'm trying to use the fs::path with ZeroC Ice, a code generator for remote calls. Ice needs to marshal and unmarshal parameters for remote calls. Apart from simple built-in types like int, float, string, it supports "sequences", which for C++ map to vector, deque, or list, and simple struct-like all-public-attributes classes. All these types can be used as funtion parameters and return types. Now I want to use fs::path as a "native" Ice function parameter. The interface description which is the input to the generator can contain "metadata" like "cpp:type". According to the documentation the build-in "string" type can be mapped only to either "std::string" or "std::wstring". But using such metadata a "sequence<string>" can be mapped to the C++ types vector<string> and the like. In fact any STL compatible container could be used. As fs::path partially looks like an STL container I tried to map a "sequence<string>" to a "fs::path". No luck. The docs say ( http://www.zeroc.com/doc/Ice-3.2.1/manual/Cpp.7.7.html#99709 ) a constructor taking the initial size is needed -.- fs::path doesn't have one. If we could make fs::path a full blown STL container maybe it'll be more useful in some contexts and I guess it'll be a little easier to use. Comments? Regards, Frank

I forgot about the replacement. Frank Birbacher schrieb:
If we could make fs::path a full blown STL container maybe it'll be more useful in some contexts and I guess it'll be a little easier to use.
Could I possibly make vector<string> be a path? Or at least make a new custom container be a path? All the operations of the filesystem library a templated with the path type being a parameter. Could I somehow specialize the path traits to make this work? Regards, Frank

Frank Birbacher wrote:
As fs::path partially looks like an STL container I tried to map a "sequence<string>" to a "fs::path". I really think you'll have better luck trying to find a workaround so you can map the path to a string.
Adding full-blown container semantics to path simply doesn't make sense. Sebastian

Hi! Sebastian Redl schrieb:
I really think you'll have better luck trying to find a workaround so you can map the path to a string.
I tried using a wrapper which implicitly converts to and from fs::path. That wrapper behaves like a vector<string> and at least complies if use with Ice. But it would be cleaner if either the fs::path was a container or the wrapper was a legal path (due to path traits or something). Regards, Frank
participants (2)
-
Frank Birbacher
-
Sebastian Redl