[filesystem] Using basic_path in char-type generic code
I have a char-type generic function (character type is template argument). I use only char and wchar_t character types with this function and I don't care for other character types. I wanted to use basic_path in that function so that I will get either path or wpath depending on the template argument. But I failed to do that since basic_path has second template argument (Traits) which - as opposed to basic_string - does not default to anything. Even more, there is no (or at least documentation does not mention that) default path_traits template which could be parametrized with the desired character type. Why is it so? How to overcome it (otherwise then writing my own auxiliary type selector)? (I am using version boost 1.39 and will - hopefully, if it will correct compilation errors - switch to 1.43 when it will be released.) Adam Badura
AMDG Adam Badura wrote:
I have a char-type generic function (character type is template argument). I use only char and wchar_t character types with this function and I don't care for other character types. I wanted to use basic_path in that function so that I will get either path or wpath depending on the template argument. But I failed to do that since basic_path has second template argument (Traits) which - as opposed to basic_string - does not default to anything. Even more, there is no (or at least documentation does not mention that) default path_traits template which could be parametrized with the desired character type. Why is it so? How to overcome it (otherwise then writing my own auxiliary type selector)?
(I am using version boost 1.39 and will - hopefully, if it will correct compilation errors - switch to 1.43 when it will be released.)
There are two independent structs, path_traits and wpath_traits. In Christ, Steven Watanabe
There are two independent structs, path_traits and wpath_traits.
Yes. And this is the problem since it makes it impossible to use basic_path in the same character independent type as we can use basic_string. Can this be solved somehow? For example by making the traits a template class (dependent on the character type) and provide only two specializations for char and wchar_t? Adam Badura
Adam Badura wrote:
There are two independent structs, path_traits and wpath_traits.
Yes. And this is the problem since it makes it impossible to use basic_path in the same character independent type as we can use basic_string. Can this be solved somehow? For example by making the traits a template class (dependent on the character type) and provide only two specializations for char and wchar_t?
Adam Badura
IIUC, beman's recent beta of Filesystem V3 directly addresses these issues. There are recent postings on the devel list. Jeff
participants (3)
-
Adam Badura
-
Jeff Flinn
-
Steven Watanabe