diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-03 14:21:51 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-04 16:44:41 -0700 |
| commit | 604d0e58dab76f8ab31eb4f7807f7b561c4d571d (patch) | |
| tree | 56c5f18eaa5cc9e3fa7129a7479e243c4db44988 /toolsrc/include/cstring_view.h | |
| parent | 80e48c2756cc2c453ba221fe38c32f969d5139ea (diff) | |
| download | vcpkg-604d0e58dab76f8ab31eb4f7807f7b561c4d571d.tar.gz vcpkg-604d0e58dab76f8ab31eb4f7807f7b561c4d571d.zip | |
cstring_view -> CStringView
Diffstat (limited to 'toolsrc/include/cstring_view.h')
| -rw-r--r-- | toolsrc/include/cstring_view.h | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/toolsrc/include/cstring_view.h b/toolsrc/include/cstring_view.h deleted file mode 100644 index 92f1a6fa5..000000000 --- a/toolsrc/include/cstring_view.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once -#include <string> - -namespace vcpkg -{ - template<class CharType> - struct basic_cstring_view - { - constexpr basic_cstring_view() : cstr(nullptr) {} - constexpr basic_cstring_view(const CharType* cstr) : cstr(cstr) {} - basic_cstring_view(const std::basic_string<CharType>& str) : cstr(str.c_str()) {} - - constexpr operator const CharType*() const { return cstr; } - - constexpr const CharType* c_str() const { return cstr; } - - private: - const CharType* cstr; - }; - - using cstring_view = basic_cstring_view<char>; - using cwstring_view = basic_cstring_view<wchar_t>; - - inline const char* to_printf_arg(const cstring_view spec) { return spec.c_str(); } - - inline const wchar_t* to_wprintf_arg(const cwstring_view spec) { return spec.c_str(); } - - static_assert(sizeof(cstring_view) == sizeof(void*), "cstring_view must be a simple wrapper around char*"); - static_assert(sizeof(cwstring_view) == sizeof(void*), "cwstring_view must be a simple wrapper around wchar_t*"); -} |
