mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
Added support for std::string_view based path functions when using C++17
This commit is contained in:
parent
ec2bc5af0c
commit
e49340a846
10
README.md
10
README.md
@ -311,9 +311,11 @@ path& operator+=(basic_string_view<value_type> x);
|
||||
int compare(basic_string_view<value_type> s) const;
|
||||
```
|
||||
|
||||
These are not implemented, as there is no `std::basic_string_view` available in
|
||||
C++11 and I did want to keep this implementation self-contained and not
|
||||
write a full C++17-upgrade for C++11.
|
||||
These are not implemented under C++11 and C++14, as there is no
|
||||
`std::basic_string_view` available and I did want to keep this
|
||||
implementation self-contained and not write a full C++17-upgrade for
|
||||
C++11/14. Starting with v1.1.0 these are supported when compiling
|
||||
ghc::filesystem under C++17.
|
||||
|
||||
|
||||
### Differences in API
|
||||
@ -449,6 +451,8 @@ to the expected behavior.
|
||||
additional simple includes are added, that can be used to forward
|
||||
`ghc::filesystem` declarations (`fs_fwd.hpp`) and to wrap the
|
||||
implementation into a single cpp (`fs_impl.hpp`)
|
||||
* The `std::basic_string_view` variants of the `fs::path` api are
|
||||
now supported when compiling with C++17.
|
||||
|
||||
|
||||
### [v1.0.10](https://github.com/gulrak/filesystem/releases/tag/v1.0.10)
|
||||
|
@ -190,6 +190,12 @@ public:
|
||||
struct _is_basic_string<std::basic_string<CharT, Traits, Alloc>> : std::true_type
|
||||
{
|
||||
};
|
||||
#ifdef __cpp_lib_string_view
|
||||
template <class CharT>
|
||||
struct _is_basic_string<std::basic_string_view<CharT>> : std::true_type
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename T1, typename T2 = void>
|
||||
using path_type = typename std::enable_if<!std::is_same<path, T1>::value, path>::type;
|
||||
@ -237,7 +243,9 @@ public:
|
||||
// 30.10.8.4.4 concatenation
|
||||
path& operator+=(const path& x);
|
||||
path& operator+=(const string_type& x);
|
||||
// path& operator+=(basic_string_view<value_type> x);
|
||||
#ifdef __cpp_lib_string_view
|
||||
path& operator+=(std::basic_string_view<value_type> x);
|
||||
#endif
|
||||
path& operator+=(const value_type* x);
|
||||
path& operator+=(value_type x);
|
||||
template <class Source>
|
||||
@ -281,7 +289,9 @@ public:
|
||||
// 30.10.8.4.8 compare
|
||||
int compare(const path& p) const noexcept;
|
||||
int compare(const string_type& s) const;
|
||||
// int compare(basic_string_view<value_type> s) const;
|
||||
#ifdef __cpp_lib_string_view
|
||||
int compare(std::basic_string_view<value_type> s) const;
|
||||
#endif
|
||||
int compare(const value_type* s) const;
|
||||
|
||||
// 30.10.8.4.9 decomposition
|
||||
@ -1947,7 +1957,12 @@ GHC_INLINE path& path::operator+=(const string_type& x)
|
||||
return concat(x);
|
||||
}
|
||||
|
||||
// path& operator+=(basic_string_view<value_type> x);
|
||||
#ifdef __cpp_lib_string_view
|
||||
GHC_INLINE path& path::operator+=(std::basic_string_view<value_type> x)
|
||||
{
|
||||
return concat(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
GHC_INLINE path& path::operator+=(const value_type* x)
|
||||
{
|
||||
@ -2159,11 +2174,12 @@ GHC_INLINE int path::compare(const string_type& s) const
|
||||
return native().compare(path(s).native());
|
||||
}
|
||||
|
||||
/*
|
||||
int path::compare(basic_string_view<value_type> s) const
|
||||
#ifdef __cpp_lib_string_view
|
||||
GHC_INLINE int path::compare(std::basic_string_view<value_type> s) const
|
||||
{
|
||||
return native().compare(path(s).native());
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
GHC_INLINE int path::compare(const value_type* s) const
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user