mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Merge remote-tracking branch 'Microsoft/master' into alternate_byte_impl
This commit is contained in:
commit
536ce5c15d
135
.travis.yml
135
.travis.yml
@ -3,65 +3,140 @@
|
|||||||
language: cpp
|
language: cpp
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/cmake
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.5.2/install
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.2/install
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.1/install
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.1/install
|
||||||
|
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.9.0/install
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- env: COMPILER=clang++-3.6 BUILD_TYPE=Debug CLANG=1
|
- env: BUILD_TYPE=Debug
|
||||||
|
os: osx
|
||||||
|
osx_image: xcode8
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
- env: BUILD_TYPE=Release
|
||||||
|
os: osx
|
||||||
|
osx_image: xcode8
|
||||||
|
compiler: clang
|
||||||
|
- env: CLANG_VERSION=3.6 BUILD_TYPE=Debug
|
||||||
|
os: linux
|
||||||
addons: &clang36
|
addons: &clang36
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- clang-3.6
|
- clang-3.6
|
||||||
- cmake
|
|
||||||
- g++-5
|
- g++-5
|
||||||
sources: &sources
|
sources: &sources
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
- llvm-toolchain-precise-3.6
|
- llvm-toolchain-precise-3.6
|
||||||
- kalakris-cmake
|
- env: CLANG_VERSION=3.6 BUILD_TYPE=Release
|
||||||
- env: COMPILER=clang++-3.6 BUILD_TYPE=Release CLANG=1
|
os: linux
|
||||||
compiler: clang
|
|
||||||
addons: *clang36
|
addons: *clang36
|
||||||
- env: COMPILER=g++-5 BUILD_TYPE=Debug
|
- env: CLANG_VERSION=3.7 BUILD_TYPE=Debug
|
||||||
compiler: gcc
|
os: linux
|
||||||
|
addons: &clang37
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.7
|
||||||
|
- g++-5
|
||||||
|
sources: &sources
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.7
|
||||||
|
- env: CLANG_VERSION=3.7 BUILD_TYPE=Release
|
||||||
|
os: linux
|
||||||
|
addons: *clang37
|
||||||
|
- env: CLANG_VERSION=3.8 BUILD_TYPE=Debug
|
||||||
|
os: linux
|
||||||
|
addons: &clang38
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.8
|
||||||
|
- g++-5
|
||||||
|
sources: &sources
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.8
|
||||||
|
- env: CLANG_VERSION=3.8 BUILD_TYPE=Release
|
||||||
|
os: linux
|
||||||
|
addons: *clang38
|
||||||
|
- env: GCC_VERSION=5 BUILD_TYPE=Debug
|
||||||
|
os: linux
|
||||||
addons: &gcc5
|
addons: &gcc5
|
||||||
apt:
|
apt:
|
||||||
packages: g++-5
|
packages: g++-5
|
||||||
sources: *sources
|
sources: *sources
|
||||||
- env: COMPILER=g++-5 BUILD_TYPE=Release
|
- env: GCC_VERSION=5 BUILD_TYPE=Release
|
||||||
compiler: gcc
|
os: linux
|
||||||
addons: *gcc5
|
addons: *gcc5
|
||||||
|
- env: GCC_VERSION=6 BUILD_TYPE=Debug
|
||||||
|
os: linux
|
||||||
|
addons: &gcc6
|
||||||
|
apt:
|
||||||
|
packages: g++-6
|
||||||
|
sources: *sources
|
||||||
|
- env: GCC_VERSION=6 BUILD_TYPE=Release
|
||||||
|
os: linux
|
||||||
|
addons: *gcc6
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- which $COMPILER
|
- if [[ -n "$CLANG_VERSION" ]]; then export CXX=clang++-$CLANG_VERSION CC=clang-$CLANG_VERSION; fi
|
||||||
|
- if [[ -n "$GCC_VERSION" ]]; then export CXX=g++-$GCC_VERSION CC=gcc-$GCC_VERSION; fi
|
||||||
|
- JOBS=2
|
||||||
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
||||||
- mkdir ${DEPS_DIR} && cd ${DEPS_DIR}
|
- mkdir -p "${DEPS_DIR}" && cd "${DEPS_DIR}"
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
# Install a recent CMake (unless already installed on OS X)
|
||||||
|
############################################################################
|
||||||
- |
|
- |
|
||||||
if [[ "$CLANG" == 1 && "${TRAVIS_OS_NAME}" == "linux" && "${STDLIB}" != "libstdc++" ]]; then
|
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||||
if [[ "${COMPILER}" == "clang++-3.5" ]]; then LLVM_VERSION="3.5.2"; fi
|
if [[ -z "$(ls -A ${DEPS_DIR}/cmake/bin)" ]]; then
|
||||||
if [[ "${COMPILER}" == "clang++-3.6" ]]; then LLVM_VERSION="3.6.2"; fi
|
CMAKE_URL="https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz"
|
||||||
if [[ "${COMPILER}" == "clang++-3.7" ]]; then LLVM_VERSION="3.7.0"; fi
|
mkdir -p cmake && travis_retry wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C cmake
|
||||||
|
fi
|
||||||
|
export PATH="${DEPS_DIR}/cmake/bin:${PATH}"
|
||||||
|
else
|
||||||
|
if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
# [linux]: Install the right version of libc++
|
||||||
|
############################################################################
|
||||||
|
- |
|
||||||
|
if [[ -n "$CLANG_VERSION" && "${TRAVIS_OS_NAME}" == "linux" && "${STDLIB}" != "libstdc++" ]]; then
|
||||||
|
if [[ "$CLANG_VERSION" == "3.5" ]]; then LLVM_VERSION="3.5.2"; fi
|
||||||
|
if [[ "$CLANG_VERSION" == "3.6" ]]; then LLVM_VERSION="3.6.2"; fi
|
||||||
|
if [[ "$CLANG_VERSION" == "3.7" ]]; then LLVM_VERSION="3.7.1"; fi
|
||||||
|
if [[ "$CLANG_VERSION" == "3.8" ]]; then LLVM_VERSION="3.8.1"; fi
|
||||||
|
if [[ "$CLANG_VERSION" == "3.9" ]]; then LLVM_VERSION="3.9.0"; fi
|
||||||
|
LLVM_ROOT="${DEPS_DIR}/llvm-${LLVM_VERSION}"
|
||||||
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
|
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
|
||||||
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
|
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
|
||||||
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
|
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
|
||||||
mkdir -p llvm llvm/build llvm/projects/libcxx llvm/projects/libcxxabi
|
if [[ -z "$(ls -A ${LLVM_ROOT}/install/include)" ]]; then
|
||||||
travis_retry wget --quiet -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C llvm
|
mkdir -p "${LLVM_ROOT}" "${LLVM_ROOT}/build" "${LLVM_ROOT}/projects/libcxx" "${LLVM_ROOT}/projects/libcxxabi"
|
||||||
travis_retry wget --quiet -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxx
|
travis_retry wget --quiet -O - "${LLVM_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}"
|
||||||
travis_retry wget --quiet -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxxabi
|
travis_retry wget --quiet -O - "${LIBCXX_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxx"
|
||||||
(cd llvm/build && cmake .. -DCMAKE_INSTALL_PREFIX=${DEPS_DIR}/llvm/install -DCMAKE_CXX_COMPILER=clang++)
|
travis_retry wget --quiet -O - "${LIBCXXABI_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxxabi"
|
||||||
(cd llvm/build/projects/libcxx && make install -j2)
|
(cd "${LLVM_ROOT}/build" && cmake .. -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_C_COMPILER="$CC" -DCMAKE_INSTALL_PREFIX="${LLVM_ROOT}/install" -DCMAKE_BUILD_TYPE=$BUILD_TYPE)
|
||||||
(cd llvm/build/projects/libcxxabi && make install -j2)
|
(cd "${LLVM_ROOT}/build/projects/libcxx" && make install -j$JOBS)
|
||||||
export CXXFLAGS="-I ${DEPS_DIR}/llvm/install/include/c++/v1"
|
(cd "${LLVM_ROOT}/build/projects/libcxxabi" && make install -j$JOBS)
|
||||||
export LDFLAGS="-L ${DEPS_DIR}/llvm/install/lib -l c++ -l c++abi"
|
fi
|
||||||
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DEPS_DIR}/llvm/install/lib"
|
export CXXFLAGS="-I ${LLVM_ROOT}/install/include/c++/v1"
|
||||||
|
export LDFLAGS="-L ${LLVM_ROOT}/install/lib -lc++ -lc++abi"
|
||||||
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_ROOT}/install/lib"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
- cd "${TRAVIS_BUILD_DIR}"
|
||||||
- cmake -H. -Bb -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_INSTALL_PREFIX=$PWD/o -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
- cmake . -Bbuild -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_C_COMPILER="$CC" -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||||
- cmake --build b
|
- cmake --build build -- -j$JOBS
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cd b
|
- cd build
|
||||||
- ctest
|
- ctest --output-on-failure -j$JOBS
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
@ -38,6 +38,14 @@
|
|||||||
#define GSL_STRINGIFY_DETAIL(x) #x
|
#define GSL_STRINGIFY_DETAIL(x) #x
|
||||||
#define GSL_STRINGIFY(x) GSL_STRINGIFY_DETAIL(x)
|
#define GSL_STRINGIFY(x) GSL_STRINGIFY_DETAIL(x)
|
||||||
|
|
||||||
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
|
#define GSL_LIKELY(x) __builtin_expect (!!(x), 1)
|
||||||
|
#define GSL_UNLIKELY(x) __builtin_expect (!!(x), 0)
|
||||||
|
#else
|
||||||
|
#define GSL_LIKELY(x) (x)
|
||||||
|
#define GSL_UNLIKELY(x) (x)
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// GSL.assert: assertions
|
// GSL.assert: assertions
|
||||||
//
|
//
|
||||||
@ -53,19 +61,19 @@ struct fail_fast : public std::runtime_error
|
|||||||
#if defined(GSL_THROW_ON_CONTRACT_VIOLATION)
|
#if defined(GSL_THROW_ON_CONTRACT_VIOLATION)
|
||||||
|
|
||||||
#define Expects(cond) \
|
#define Expects(cond) \
|
||||||
if (!(cond)) \
|
if (GSL_UNLIKELY(!(cond))) \
|
||||||
throw gsl::fail_fast("GSL: Precondition failure at " __FILE__ ": " GSL_STRINGIFY(__LINE__));
|
throw gsl::fail_fast("GSL: Precondition failure at " __FILE__ ": " GSL_STRINGIFY(__LINE__));
|
||||||
#define Ensures(cond) \
|
#define Ensures(cond) \
|
||||||
if (!(cond)) \
|
if (GSL_UNLIKELY(!(cond))) \
|
||||||
throw gsl::fail_fast("GSL: Postcondition failure at " __FILE__ \
|
throw gsl::fail_fast("GSL: Postcondition failure at " __FILE__ \
|
||||||
": " GSL_STRINGIFY(__LINE__));
|
": " GSL_STRINGIFY(__LINE__));
|
||||||
|
|
||||||
#elif defined(GSL_TERMINATE_ON_CONTRACT_VIOLATION)
|
#elif defined(GSL_TERMINATE_ON_CONTRACT_VIOLATION)
|
||||||
|
|
||||||
#define Expects(cond) \
|
#define Expects(cond) \
|
||||||
if (!(cond)) std::terminate();
|
if (GSL_UNLIKELY(!(cond))) std::terminate();
|
||||||
#define Ensures(cond) \
|
#define Ensures(cond) \
|
||||||
if (!(cond)) std::terminate();
|
if (GSL_UNLIKELY(!(cond))) std::terminate();
|
||||||
|
|
||||||
#elif defined(GSL_UNENFORCED_ON_CONTRACT_VIOLATION)
|
#elif defined(GSL_UNENFORCED_ON_CONTRACT_VIOLATION)
|
||||||
|
|
||||||
|
@ -308,8 +308,6 @@ namespace details
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundsRanges(const BoundsRanges&) = default;
|
|
||||||
BoundsRanges& operator=(const BoundsRanges&) = default;
|
|
||||||
BoundsRanges(const std::ptrdiff_t* const) {}
|
BoundsRanges(const std::ptrdiff_t* const) {}
|
||||||
BoundsRanges() = default;
|
BoundsRanges() = default;
|
||||||
|
|
||||||
@ -346,9 +344,9 @@ namespace details
|
|||||||
static const size_t DynamicNum = Base::DynamicNum + 1;
|
static const size_t DynamicNum = Base::DynamicNum + 1;
|
||||||
static const size_type CurrentRange = dynamic_range;
|
static const size_type CurrentRange = dynamic_range;
|
||||||
static const size_type TotalSize = dynamic_range;
|
static const size_type TotalSize = dynamic_range;
|
||||||
const size_type m_bound;
|
private:
|
||||||
|
size_type m_bound;
|
||||||
BoundsRanges(const BoundsRanges&) = default;
|
public:
|
||||||
|
|
||||||
BoundsRanges(const std::ptrdiff_t* const arr)
|
BoundsRanges(const std::ptrdiff_t* const arr)
|
||||||
: Base(arr + 1), m_bound(*arr * this->Base::totalSize())
|
: Base(arr + 1), m_bound(*arr * this->Base::totalSize())
|
||||||
@ -420,8 +418,6 @@ namespace details
|
|||||||
static const size_type TotalSize =
|
static const size_type TotalSize =
|
||||||
Base::TotalSize == dynamic_range ? dynamic_range : CurrentRange * Base::TotalSize;
|
Base::TotalSize == dynamic_range ? dynamic_range : CurrentRange * Base::TotalSize;
|
||||||
|
|
||||||
BoundsRanges(const BoundsRanges&) = default;
|
|
||||||
|
|
||||||
BoundsRanges(const std::ptrdiff_t* const arr) : Base(arr) {}
|
BoundsRanges(const std::ptrdiff_t* const arr) : Base(arr) {}
|
||||||
BoundsRanges() = default;
|
BoundsRanges() = default;
|
||||||
|
|
||||||
@ -633,12 +629,6 @@ public:
|
|||||||
|
|
||||||
constexpr static_bounds() = default;
|
constexpr static_bounds() = default;
|
||||||
|
|
||||||
constexpr static_bounds& operator=(const static_bounds& otherBounds)
|
|
||||||
{
|
|
||||||
new (&m_ranges) MyRanges(otherBounds.m_ranges);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr sliced_type slice() const noexcept
|
constexpr sliced_type slice() const noexcept
|
||||||
{
|
{
|
||||||
return sliced_type{static_cast<const details::BoundsRanges<RestRanges...>&>(m_ranges)};
|
return sliced_type{static_cast<const details::BoundsRanges<RestRanges...>&>(m_ranges)};
|
||||||
|
9
gsl/span
9
gsl/span
@ -132,8 +132,7 @@ namespace details
|
|||||||
|
|
||||||
template <class From, class To>
|
template <class From, class To>
|
||||||
struct is_allowed_element_type_conversion
|
struct is_allowed_element_type_conversion
|
||||||
: public std::integral_constant<bool, std::is_same<From, std::remove_cv_t<To>>::value ||
|
: public std::integral_constant<bool, std::is_convertible<From (*)[], To (*)[]>::value>
|
||||||
std::is_convertible<From(*)[], To(*)[]>::value>
|
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -420,8 +419,7 @@ public:
|
|||||||
details::is_allowed_extent_conversion<OtherExtent, Extent>::value &&
|
details::is_allowed_extent_conversion<OtherExtent, Extent>::value &&
|
||||||
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
|
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
|
||||||
constexpr span(const span<OtherElementType, OtherExtent>& other)
|
constexpr span(const span<OtherElementType, OtherExtent>& other)
|
||||||
: storage_(static_cast<pointer>(other.data()),
|
: storage_(other.data(), details::extent_type<OtherExtent>(other.size()))
|
||||||
details::extent_type<OtherExtent>(other.size()))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,8 +429,7 @@ public:
|
|||||||
details::is_allowed_extent_conversion<OtherExtent, Extent>::value &&
|
details::is_allowed_extent_conversion<OtherExtent, Extent>::value &&
|
||||||
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
|
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
|
||||||
constexpr span(span<OtherElementType, OtherExtent>&& other)
|
constexpr span(span<OtherElementType, OtherExtent>&& other)
|
||||||
: storage_(static_cast<pointer>(other.data()),
|
: storage_(other.data(), details::extent_type<OtherExtent>(other.size()))
|
||||||
details::extent_type<OtherExtent>(other.size()))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +118,24 @@ namespace details
|
|||||||
return len;
|
return len;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline std::size_t wstring_length(const wchar_t *str, std::size_t n)
|
||||||
|
{
|
||||||
|
#ifdef GSL_PLATFORM_HAS_STRNLEN
|
||||||
|
return wcsnlen(str, n);
|
||||||
|
#else
|
||||||
|
if (str == nullptr || n == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
std::size_t len = 0;
|
||||||
|
span<const wchar_t> str_span{str, n};
|
||||||
|
|
||||||
|
while (len < n && str_span[len])
|
||||||
|
len++;
|
||||||
|
|
||||||
|
return len;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -166,14 +184,14 @@ inline span<const char, dynamic_extent> ensure_z(const char* const& sz, std::ptr
|
|||||||
|
|
||||||
inline span<wchar_t, dynamic_extent> ensure_z(wchar_t* const& sz, std::ptrdiff_t max)
|
inline span<wchar_t, dynamic_extent> ensure_z(wchar_t* const& sz, std::ptrdiff_t max)
|
||||||
{
|
{
|
||||||
auto len = wcsnlen(sz, narrow_cast<size_t>(max));
|
auto len = details::wstring_length(sz, narrow_cast<size_t>(max));
|
||||||
Ensures(sz[len] == 0);
|
Ensures(sz[len] == 0);
|
||||||
return {sz, static_cast<std::ptrdiff_t>(len)};
|
return {sz, static_cast<std::ptrdiff_t>(len)};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline span<const wchar_t, dynamic_extent> ensure_z(const wchar_t* const& sz, std::ptrdiff_t max)
|
inline span<const wchar_t, dynamic_extent> ensure_z(const wchar_t* const& sz, std::ptrdiff_t max)
|
||||||
{
|
{
|
||||||
auto len = wcsnlen(sz, narrow_cast<size_t>(max));
|
auto len = details::wstring_length(sz, narrow_cast<size_t>(max));
|
||||||
Ensures(sz[len] == 0);
|
Ensures(sz[len] == 0);
|
||||||
return {sz, static_cast<std::ptrdiff_t>(len)};
|
return {sz, static_cast<std::ptrdiff_t>(len)};
|
||||||
}
|
}
|
||||||
@ -230,7 +248,7 @@ namespace details
|
|||||||
{
|
{
|
||||||
std::ptrdiff_t operator()(wchar_t* const ptr, std::ptrdiff_t length) noexcept
|
std::ptrdiff_t operator()(wchar_t* const ptr, std::ptrdiff_t length) noexcept
|
||||||
{
|
{
|
||||||
return narrow_cast<std::ptrdiff_t>(wcsnlen(ptr, narrow_cast<size_t>(length)));
|
return narrow_cast<std::ptrdiff_t>(details::wstring_length(ptr, narrow_cast<size_t>(length)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -248,7 +266,7 @@ namespace details
|
|||||||
{
|
{
|
||||||
std::ptrdiff_t operator()(const wchar_t* const ptr, std::ptrdiff_t length) noexcept
|
std::ptrdiff_t operator()(const wchar_t* const ptr, std::ptrdiff_t length) noexcept
|
||||||
{
|
{
|
||||||
return narrow_cast<std::ptrdiff_t>(wcsnlen(ptr, narrow_cast<size_t>(length)));
|
return narrow_cast<std::ptrdiff_t>(details::wstring_length(ptr, narrow_cast<size_t>(length)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user