Compare commits

...

7 Commits

Author SHA1 Message Date
Fedor Osetrov 35d8af6ce2 fix ci: turn on import std tests, fix libc++ build (#96)
This PR:
- enables tests with `import std` usage in CI
- add all tests to build with cmake_subdir_test (because there was only a subset of tests supported)
- fixes tests build with `libc++`
- disables some tests with wchar_t with 'libc++'
2026-04-24 18:03:48 +03:00
Andrey Semashev 4b0d10a1f3 Remove dependencies on Boost.StaticAssert. (#95)
Boost.StaticAssert has been merged into Boost.Config, so remove
the dependency.
2026-01-26 17:58:24 +03:00
Antony Polukhin 184f7e43f0 Update copyright years 2026-01-04 11:10:09 +03:00
dependabot[bot] 4cc0fa77b4 Bump actions/checkout from 2 to 6 (#94)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-26 22:05:36 +03:00
Antony Polukhin 4d1e18cf4c Add dependabot 2025-12-24 20:21:04 +03:00
Antony Polukhin d57771ecf1 CI fixes (#93) 2025-12-23 20:25:26 +03:00
Antony Polukhin 1b804c7a31 Implement initial version of C++20 module boost.lexical_cast (#84) 2025-12-11 22:17:21 +03:00
60 changed files with 694 additions and 189 deletions
+11
View File
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
+81 -15
View File
@@ -20,6 +20,7 @@ jobs:
- toolset: gcc-14 # Do not remove! It is the only toolset that tests CMake tests down below
cxxstd: "03,11,14,17,20"
os: ubuntu-24.04
compiler: g++-14
- toolset: gcc-12
cxxstd: "03,11,14,17,2a"
os: ubuntu-22.04
@@ -27,7 +28,7 @@ jobs:
linkflags: "linkflags=--coverage -lasan -lubsan"
gcov_tool: "gcov-12"
launcher: "testing.launcher=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.8"
- toolset: gcc-9
- toolset: gcc-11
cxxstd: "03,11,14,17,2a"
os: ubuntu-22.04
- toolset: clang
@@ -36,12 +37,17 @@ jobs:
os: ubuntu-22.04
- toolset: clang
cxxstd: "11,14,17,20"
os: macos-13
os: macos-latest
- toolset: clang-19
cxxstd: "20,23"
os: ubuntu-24.04
compiler: clang++-19
install: clang-19 llvm-19 libclang-rt-19-dev libc++-19-dev libc++abi-19-dev clang-tools-19
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: Install packages
if: matrix.install
@@ -71,16 +77,49 @@ jobs:
./bootstrap.sh
./b2 -j4 variant=debug tools/inspect
- name: Run modules tests without 'import std;'
if: ${{matrix.toolset == 'clang-19'}}
run: |
cd ../boost-root/libs/lexical_cast
cmake -S test/cmake_subdir_test -B build_module \
-GNinja \
-DBUILD_TESTING=1 \
-DBOOST_USE_MODULES=1 \
-DCMAKE_CXX_COMPILER=clang++-19 \
-DCMAKE_C_COMPILER=clang-19
cmake --build build_module
ctest --test-dir build_module -V --no-tests=error
rm -rf build_module
- name: Run modules tests
if: ${{matrix.toolset == 'clang-19'}}
run: |
cd ../boost-root/libs/lexical_cast
cmake -S test/cmake_subdir_test -B build_module \
-GNinja \
-DBUILD_TESTING=1 \
-DBOOST_USE_MODULES=1 \
-DCMAKE_CXX_COMPILER=clang++-19 \
-DCMAKE_C_COMPILER=clang-19 \
-DCMAKE_CXX_FLAGS=-stdlib=libc++ \
-DCMAKE_CXX_STANDARD=23 \
-DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 \
-DCMAKE_CXX_MODULE_STD=ON
cmake --build build_module
ctest --test-dir build_module -V --no-tests=error
rm -rf build_module
- name: Run CMake tests
if: ${{matrix.toolset == 'gcc-14'}}
if: ${{matrix.toolset == 'gcc-14' || matrix.toolset == 'clang-19'}}
run: |
cd ../boost-root/
mkdir __build
cd __build
cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=lexical_cast -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_C_COMPILER=gcc-14 ..
cmake --build . --target tests
ctest --output-on-failure --no-tests=error
cd ..
cmake -S . -B __build \
-DBUILD_TESTING=1 \
-DBOOST_INCLUDE_LIBRARIES=lexical_cast \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DCMAKE_C_COMPILER=${{matrix.toolset}}
cmake --build __build --target tests
ctest --test-dir __build --output-on-failure --no-tests=error
rm -rf __build
- name: Run tests
@@ -138,7 +177,7 @@ jobs:
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: Setup Boost
shell: cmd
@@ -157,7 +196,7 @@ jobs:
git clone -b %BOOST_BRANCH% --depth 10 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
git submodule update --init tools/boostdep libs/test
python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--jobs 3" %LIBRARY%
cmd /c bootstrap
@@ -170,11 +209,38 @@ jobs:
cd ../boost-root/
mkdir __build
cd __build
cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=lexical_cast ..
cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=lexical_cast -G Ninja ..
cmake --build . --target tests --config Debug
ctest --output-on-failure --no-tests=error -C Debug
cd ..
rm -rf __build
- name: Run modules tests
if: false
#if: ${{matrix.toolset == 'msvc-14.3'}}
shell: cmd
run: |
choco install --no-progress ninja
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64
cd ../boost-root/libs/lexical_cast
rm -rf build_module
mkdir build_module
cd build_module
cmake -DBOOST_USE_MODULES=1 -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja ../test/cmake_subdir_test/
cmake --build .
ctest --no-tests=error -V
- name: Run modules tests without 'import std;'
if: ${{matrix.toolset == 'msvc-14.3'}}
shell: cmd
run: |
choco install --no-progress ninja
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64
cd ../boost-root/libs/lexical_cast
rm -rf build_module
mkdir build_module
cd build_module
cmake -DBOOST_USE_MODULES=1 -DCMAKE_CXX_STANDARD=20 -G Ninja ../test/cmake_subdir_test/
cmake --build .
ctest --no-tests=error -V
- name: Run tests
shell: cmd
+25 -5
View File
@@ -3,23 +3,43 @@
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
cmake_minimum_required(VERSION 3.5...4.0)
project(boost_lexical_cast VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_lexical_cast INTERFACE)
add_library(Boost::lexical_cast ALIAS boost_lexical_cast)
target_include_directories(boost_lexical_cast INTERFACE include)
if (BOOST_USE_MODULES)
add_library(boost_lexical_cast)
target_sources(boost_lexical_cast PUBLIC
FILE_SET modules_public TYPE CXX_MODULES FILES
${CMAKE_CURRENT_LIST_DIR}/modules/boost_lexical_cast.cppm
)
target_compile_features(boost_lexical_cast PUBLIC cxx_std_20)
target_compile_definitions(boost_lexical_cast PUBLIC BOOST_USE_MODULES)
if (CMAKE_CXX_COMPILER_IMPORT_STD)
target_compile_definitions(boost_lexical_cast PRIVATE BOOST_LEXICAL_CAST_USE_STD_MODULE)
message(STATUS "Using `import std;`")
else()
message(STATUS "`import std;` is not available")
endif()
set(__scope PUBLIC)
else()
add_library(boost_lexical_cast INTERFACE)
set(__scope INTERFACE)
endif()
target_include_directories(boost_lexical_cast ${__scope} include)
target_link_libraries(boost_lexical_cast
INTERFACE
${__scope}
Boost::config
Boost::container
Boost::core
Boost::throw_exception
)
add_library(Boost::lexical_cast ALIAS boost_lexical_cast)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright Antony Polukhin, 2011-2025.
# Copyright Antony Polukhin, 2011-2026.
#
# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
+38 -1
View File
@@ -3,7 +3,7 @@
[version 1.0]
[copyright 2000-2005 Kevlin Henney]
[copyright 2006-2010 Alexander Nasonov]
[copyright 2011-2025 Antony Polukhin]
[copyright 2011-2026 Antony Polukhin]
[category String and text processing]
[category Miscellaneous]
[license
@@ -233,8 +233,45 @@ limitation of compiler options that you use.
[endsect]
[section C++20 module]
[caution C++20 module support is on early stage, targets, flags and behavior may change in the future]
If using modern CMake define CMake option `-DBOOST_USE_MODULES=1` to build a C++20 module and
make the `Boost::lexical_cast` CMake target provide it. After that an explicit usage of C++20 module `boost.lexical_cast` is allowed:
[import ../modules/usage_sample.cpp]
[lexical_cast_module_example]
The `Boost::lexical_cast` CMake target gives an ability to mix includes and imports of the library in different translation units. Moreover,
if `BOOST_USE_MODULES` macro is defined then all the `boost/lexical_cast...` includes implicitly do `import boost.lexical_cast;` to give all the
benefits of modules without changing the existing code.
[note For better compile times make sure that `import std;` is available when building the `boost.lexical_cast` module (in CMake logs there should be
a 'Using `import std;`' message). ]
If not using CMake, then the module could be build manually from the `modules/boost_lexical_cast.cppm` file.
For manual module build the following commands could be used for clang compiler:
```
cd lexical_cast/modules
clang++ -I ../include -std=c++20 --precompile -x c++-module boost_lexical_cast.cppm
```
After that, the module could be used in the following way:
```
clang++ -std=c++20 -fmodule-file=boost_lexical_cast.pcm boost_lexical_cast.pcm usage_sample.cpp
```
[endsect]
[section Changes]
* [*boost 1.91.0 :]
* Added C++20 modules support.
* [*boost 1.86.0 :]
* Fixed conversion of `std::basic_string_view` and `boost::basic_string_view`
+3 -2
View File
@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2013-2025.
// Copyright Antony Polukhin, 2013-2026.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
@@ -7,9 +7,10 @@
//[lexical_cast_args_example
//`The following example treats command line arguments as a sequence of numeric data
#include <boost/lexical_cast.hpp>
#include <vector>
#include <boost/lexical_cast.hpp>
int main(int /*argc*/, char * argv[])
{
using boost::lexical_cast;
+7 -5
View File
@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2013-2025.
// Copyright Antony Polukhin, 2013-2026.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
@@ -20,6 +20,12 @@
Step 1: Making a functor that converts any type to a string and remembers result:
*/
#include <string>
#include <boost/fusion/include/for_each.hpp>
#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/fusion/adapted/std_pair.hpp>
#include <boost/lexical_cast.hpp>
struct stringize_functor {
@@ -38,7 +44,6 @@ public:
};
//` Step 2: Applying `stringize_functor` to each element in sequence:
#include <boost/fusion/include/for_each.hpp>
template <class Sequence>
std::string stringize(const Sequence& seq) {
std::string result;
@@ -47,9 +52,6 @@ std::string stringize(const Sequence& seq) {
}
//` Step 3: Using the `stringize` with different types:
#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/fusion/adapted/std_pair.hpp>
int main() {
std::tuple<char, int, char, int> decim('-', 10, 'e', 5);
if (stringize(decim) != "-10e5") {
+4 -3
View File
@@ -1,15 +1,16 @@
// Copyright Antony Polukhin, 2013-2025.
// Copyright Antony Polukhin, 2013-2026.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
#include <boost/lexical_cast.hpp>
#include <array>
#include <string>
#include <string.h>
#include <cstdio>
#include <boost/lexical_cast.hpp>
#ifdef BOOST_MSVC
# pragma warning(disable: 4996) // `strerror` is not safe
#endif
+6 -2
View File
@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2013-2025.
// Copyright Antony Polukhin, 2013-2026.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
@@ -10,9 +10,13 @@
In this example we'll make a `to_long_double` method that converts value of the Boost.Variant to `long double`.
*/
#include <boost/lexical_cast.hpp>
#ifdef BOOST_USE_MODULES
#include <compare>
#endif
#include <boost/variant.hpp>
#include <boost/lexical_cast.hpp>
struct to_long_double_functor: boost::static_visitor<long double> {
template <class T>
long double operator()(const T& v) const {
+11 -1
View File
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,10 +18,16 @@
#ifndef BOOST_LEXICAL_CAST_INCLUDED
#define BOOST_LEXICAL_CAST_INCLUDED
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#endif
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
#define BOOST_LCAST_NO_WCHAR_T
@@ -34,6 +40,7 @@
namespace boost
{
BOOST_LEXICAL_CAST_BEGIN_MODULE_EXPORT
template <typename Target, typename Source>
inline Target lexical_cast(const Source &arg)
{
@@ -94,9 +101,12 @@ namespace boost
);
}
BOOST_LEXICAL_CAST_END_MODULE_EXPORT
} // namespace boost
#undef BOOST_LCAST_NO_WCHAR_T
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_INCLUDED
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,6 +18,11 @@
#ifndef BOOST_LEXICAL_CAST_BAD_LEXICAL_CAST_HPP
#define BOOST_LEXICAL_CAST_BAD_LEXICAL_CAST_HPP
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
@@ -26,9 +31,11 @@
#include <exception>
#include <typeinfo>
#include <boost/throw_exception.hpp>
#endif
namespace boost
{
BOOST_LEXICAL_CAST_BEGIN_MODULE_EXPORT
// exception used to indicate runtime lexical_cast failure
class BOOST_SYMBOL_VISIBLE bad_lexical_cast :
// workaround MSVC bug with std::bad_cast when _HAS_EXCEPTIONS == 0
@@ -80,6 +87,7 @@ namespace boost
const type_info_t *target;
#endif
};
BOOST_LEXICAL_CAST_END_MODULE_EXPORT
namespace conversion { namespace detail {
#ifdef BOOST_NO_TYPEID
@@ -97,4 +105,6 @@ namespace boost
} // namespace boost
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_BAD_LEXICAL_CAST_HPP
@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -7,12 +7,18 @@
#ifndef BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP
#define BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <iosfwd>
#endif
namespace boost { namespace conversion { namespace detail {
@@ -55,5 +61,7 @@ namespace boost { namespace conversion { namespace detail {
}}} // namespace boost::conversion::detail
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP
@@ -0,0 +1,22 @@
// Copyright Antony Polukhin, 2021-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_LEXICAL_CAST_DETAIL_CONFIG_HPP
#define BOOST_LEXICAL_CAST_DETAIL_CONFIG_HPP
#ifdef BOOST_LEXICAL_CAST_INTERFACE_UNIT
# define BOOST_LEXICAL_CAST_BEGIN_MODULE_EXPORT export {
# define BOOST_LEXICAL_CAST_END_MODULE_EXPORT }
#else
# define BOOST_LEXICAL_CAST_BEGIN_MODULE_EXPORT
# define BOOST_LEXICAL_CAST_END_MODULE_EXPORT
#endif
#if defined(BOOST_USE_MODULES) && !defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
import boost.lexical_cast;
#endif
#endif // #ifndef BOOST_LEXICAL_CAST_DETAIL_CONFIG_HPP
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,6 +18,11 @@
#ifndef BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP
#define BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
@@ -27,15 +32,11 @@
#define BOOST_LCAST_NO_WCHAR_T
#endif
#include <array>
#include <cstddef>
#include <string>
#include <type_traits>
#include <boost/limits.hpp>
#include <boost/detail/lcast_precision.hpp>
#include <boost/lexical_cast/detail/widest_char.hpp>
#include <boost/lexical_cast/detail/is_character.hpp>
#include <boost/lexical_cast/detail/type_traits.hpp>
#include <array>
@@ -43,9 +44,14 @@
#include <string_view>
#endif
#include <boost/lexical_cast/detail/buffer_view.hpp>
#include <boost/container/container_fwd.hpp>
#endif // #ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/lexical_cast/detail/lcast_precision.hpp>
#include <boost/lexical_cast/detail/widest_char.hpp>
#include <boost/lexical_cast/detail/is_character.hpp>
#include <boost/lexical_cast/detail/buffer_view.hpp>
#include <boost/lexical_cast/detail/converter_lexical_streams.hpp>
namespace boost {
@@ -479,5 +485,7 @@ namespace boost {
#undef BOOST_LCAST_NO_WCHAR_T
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,12 +18,16 @@
#ifndef BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_STREAMS_HPP
#define BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_STREAMS_HPP
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
#define BOOST_LCAST_NO_WCHAR_T
#endif
@@ -33,9 +37,8 @@
#include <cstring>
#include <cstdio>
#include <type_traits>
#include <boost/limits.hpp>
#include <boost/detail/lcast_precision.hpp>
#include <boost/lexical_cast/detail/type_traits.hpp>
#include <boost/config/workaround.hpp>
#include <boost/core/snprintf.hpp>
@@ -58,21 +61,28 @@
#include <sstream>
#endif
#include <boost/lexical_cast/detail/buffer_view.hpp>
#include <boost/lexical_cast/detail/lcast_char_constants.hpp>
#include <boost/lexical_cast/detail/lcast_unsigned_converters.hpp>
#include <boost/lexical_cast/detail/lcast_basic_unlockedbuf.hpp>
#include <boost/lexical_cast/detail/inf_nan.hpp>
#include <istream>
#include <array>
#ifndef BOOST_NO_CWCHAR
# include <cwchar>
#endif
#include <istream>
#include <boost/container/container_fwd.hpp>
#ifndef BOOST_NO_CWCHAR
# include <cwchar>
#endif
#endif // #ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/lexical_cast/detail/buffer_view.hpp>
#include <boost/lexical_cast/detail/lcast_char_constants.hpp>
#include <boost/lexical_cast/detail/lcast_unsigned_converters.hpp>
#include <boost/lexical_cast/detail/lcast_basic_unlockedbuf.hpp>
#include <boost/lexical_cast/detail/inf_nan.hpp>
#include <boost/lexical_cast/detail/lcast_precision.hpp>
#include <boost/lexical_cast/detail/type_traits.hpp>
// Forward declarations
namespace boost {
template<class T, std::size_t N>
@@ -747,5 +757,7 @@ namespace boost { namespace detail { namespace lcast {
#undef BOOST_LCAST_NO_WCHAR_T
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,6 +18,11 @@
#ifndef BOOST_LEXICAL_CAST_DETAIL_CONVERTER_NUMERIC_HPP
#define BOOST_LEXICAL_CAST_DETAIL_CONVERTER_NUMERIC_HPP
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
@@ -26,6 +31,9 @@
#include <type_traits>
#include <boost/core/cmath.hpp>
#include <boost/limits.hpp>
#endif // #ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/lexical_cast/detail/type_traits.hpp>
namespace boost { namespace detail {
@@ -176,5 +184,7 @@ struct dynamic_num_converter_impl
}} // namespace boost::detail
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_DETAIL_CONVERTER_NUMERIC_HPP
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,6 +18,11 @@
#ifndef BOOST_LEXICAL_CAST_DETAIL_INF_NAN_HPP
#define BOOST_LEXICAL_CAST_DETAIL_INF_NAN_HPP
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
@@ -32,6 +37,7 @@
#include <boost/core/cmath.hpp>
#include <cstddef>
#include <cstring>
#endif // #ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/lexical_cast/detail/lcast_char_constants.hpp>
@@ -183,5 +189,7 @@ namespace boost {
#undef BOOST_LCAST_NO_WCHAR_T
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_DETAIL_INF_NAN_HPP
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,13 +18,20 @@
#ifndef BOOST_LEXICAL_CAST_DETAIL_IS_CHARACTER_HPP
#define BOOST_LEXICAL_CAST_DETAIL_IS_CHARACTER_HPP
#include <type_traits>
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <type_traits>
#endif // #ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
namespace boost { namespace detail {
// returns true, if T is one of the character types
@@ -47,5 +54,7 @@ using is_character = std::integral_constant<
}}
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_DETAIL_IS_CHARACTER_HPP
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -9,6 +9,12 @@
#ifndef BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_BASIC_UNLOCKEDBUF_HPP
#define BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_BASIC_UNLOCKEDBUF_HPP
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
@@ -25,6 +31,7 @@
#ifndef BOOST_NO_CWCHAR
# include <cwchar>
#endif
#endif // #ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
namespace boost { namespace detail { namespace lcast {
@@ -69,5 +76,7 @@ namespace boost { namespace detail { namespace lcast {
}}} // namespace boost::detail::lcast
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_BASIC_UNLOCKEDBUF_HPP
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,10 +18,16 @@
#ifndef BOOST_LEXICAL_CAST_DETAIL_LCAST_CHAR_CONSTANTS_HPP
#define BOOST_LEXICAL_CAST_DETAIL_LCAST_CHAR_CONSTANTS_HPP
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#endif // #ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
namespace boost
{
@@ -41,6 +47,7 @@ namespace boost
}
} // namespace boost
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_DETAIL_LCAST_CHAR_CONSTANTS_HPP
@@ -8,11 +8,21 @@
#ifndef BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED
#define BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <climits>
#include <ios>
#include <limits>
#include <boost/config.hpp>
#endif // #ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
namespace boost { namespace detail {
@@ -79,5 +89,7 @@ inline void lcast_set_precision(std::ios_base& stream, Source*, Target*)
}}
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,6 +18,11 @@
#ifndef BOOST_LEXICAL_CAST_DETAIL_LCAST_UNSIGNED_CONVERTERS_HPP
#define BOOST_LEXICAL_CAST_DETAIL_LCAST_UNSIGNED_CONVERTERS_HPP
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
@@ -49,6 +54,9 @@
#include <boost/lexical_cast/detail/lcast_char_constants.hpp>
#include <boost/core/noncopyable.hpp>
#endif // #ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/lexical_cast/detail/lcast_char_constants.hpp>
namespace boost
{
@@ -294,5 +302,7 @@ namespace boost
}
} // namespace boost
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_DETAIL_LCAST_UNSIGNED_CONVERTERS_HPP
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,13 +18,19 @@
#ifndef BOOST_LEXICAL_CAST_DETAIL_WIDEST_CHAR_HPP
#define BOOST_LEXICAL_CAST_DETAIL_WIDEST_CHAR_HPP
#include <type_traits>
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <type_traits>
#endif // #ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
namespace boost { namespace detail {
@@ -37,5 +43,7 @@ using widest_char = std::conditional<
}} // namespace boost::detail
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_DETAIL_WIDEST_CHAR_HPP
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -18,13 +18,19 @@
#ifndef BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP
#define BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP
#include <type_traits>
#include <boost/lexical_cast/detail/config.hpp>
#if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#ifndef BOOST_LEXICAL_CAST_INTERFACE_UNIT
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <type_traits>
#endif
#include <boost/lexical_cast/detail/buffer_view.hpp>
#include <boost/lexical_cast/detail/is_character.hpp>
#include <boost/lexical_cast/detail/converter_numeric.hpp>
@@ -45,6 +51,8 @@ namespace boost {
namespace conversion { namespace detail {
BOOST_LEXICAL_CAST_BEGIN_MODULE_EXPORT
template <typename Target, typename Source>
inline bool try_lexical_convert(const Source& arg, Target& result)
{
@@ -78,15 +86,20 @@ namespace boost {
result
);
}
BOOST_LEXICAL_CAST_END_MODULE_EXPORT
}} // namespace conversion::detail
namespace conversion {
BOOST_LEXICAL_CAST_BEGIN_MODULE_EXPORT
// ADL barrier
using ::boost::conversion::detail::try_lexical_convert;
BOOST_LEXICAL_CAST_END_MODULE_EXPORT
}
} // namespace boost
#endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_LEXICAL_CAST_INTERFACE_UNIT)
#endif // BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP
+57
View File
@@ -0,0 +1,57 @@
// Copyright (c) 2016-2025 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// To compile manually use a command like the folowing:
// clang++ -I ../include -std=c++20 --precompile -x c++-module boost_lexical_cast.cppm
module;
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <boost/container/container_fwd.hpp>
#include <boost/core/cmath.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/core/snprintf.hpp>
#include <boost/limits.hpp>
#include <boost/throw_exception.hpp>
#include <boost/detail/basic_pointerbuf.hpp>
#ifndef BOOST_LEXICAL_CAST_USE_STD_MODULE
#include <array>
#include <climits>
#include <cstddef>
#include <cstdio>
#include <cstring>
#ifndef BOOST_NO_CWCHAR
# include <cwchar>
#endif
#include <exception>
#include <iosfwd>
#include <istream>
#ifndef BOOST_NO_STD_LOCALE
# include <locale>
#endif
#include <sstream>
#include <string>
#include <string_view>
#include <typeinfo>
#include <type_traits>
#endif
#define BOOST_LEXICAL_CAST_INTERFACE_UNIT
export module boost.lexical_cast;
#ifdef BOOST_LEXICAL_CAST_USE_STD_MODULE
import std;
#endif
#ifdef __clang__
# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview"
#endif
#include <boost/lexical_cast.hpp>
+16
View File
@@ -0,0 +1,16 @@
// Copyright (c) 2024-2025 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// To compile manually use a command like the following:
// clang++ -std=c++20 -fmodule-file=lexical_cast.pcm lexical_cast.pcm usage_sample.cpp
//[lexical_cast_module_example
import boost.lexical_cast;
int main() {
return boost::lexical_cast<int>("0");
}
//]
+1 -1
View File
@@ -1,5 +1,5 @@
#==============================================================================
# Copyright (c) Antony Polukhin, 2012-2024.
# Copyright Antony Polukhin, 2012-2026.
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+1 -1
View File
@@ -1,4 +1,4 @@
// (C) Copyright Antony Polukhin, 2012-2025.
// (C) Copyright Antony Polukhin, 2012-2026.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+60 -41
View File
@@ -1,65 +1,84 @@
# Copyright (c) 2016-2025 Antony Polukhin
# Copyright Antony Polukhin, 2021-2026.
#
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(NOT HAVE_BOOST_TEST)
return()
if(NOT TARGET tests)
add_custom_target(tests)
endif()
set(BOOST_TEST_LINK_LIBRARIES Boost::lexical_cast Boost::core)
function(boost_lexical_cast_add_test_impl test_name test_file libs)
add_executable(${test_name} ${test_file})
target_link_libraries(${test_name} PRIVATE ${libs})
add_test(NAME ${test_name} COMMAND ${test_name})
add_dependencies(tests ${test_name})
endfunction()
boost_test(TYPE run SOURCES lexical_cast_test.cpp LINK_LIBRARIES Boost::type_traits)
boost_test(TYPE run SOURCES loopback_test.cpp)
boost_test(TYPE run SOURCES abstract_test.cpp)
boost_test(TYPE run SOURCES noncopyable_test.cpp)
boost_test(TYPE run SOURCES vc8_bug_test.cpp)
boost_test(TYPE run SOURCES implicit_convert.cpp)
boost_test(TYPE run SOURCES wchars_test.cpp)
boost_test(TYPE run SOURCES float_types_test.cpp)
function(boost_lexical_cast_add_test name libs)
set(test_name lexical_cast_${name})
set(test_file ${name}.cpp)
boost_lexical_cast_add_test_impl(${test_name} ${test_file} "Boost::lexical_cast;${libs}")
endfunction()
boost_lexical_cast_add_test(lexical_cast_test Boost::type_traits)
boost_lexical_cast_add_test(loopback_test "")
boost_lexical_cast_add_test(abstract_test "")
boost_lexical_cast_add_test(noncopyable_test "")
boost_lexical_cast_add_test(vc8_bug_test "")
boost_lexical_cast_add_test(implicit_convert "")
boost_lexical_cast_add_test(wchars_test "")
boost_lexical_cast_add_test(float_types_test "")
if(NOT MSVC)
# Make sure that LexicalCast works the same way as some of the C++ Standard Libraries
boost_test(TYPE run SOURCES float_types_test.cpp COMPILE_DEFINITIONS BOOST_LEXICAL_CAST_DETAIL_TEST_ON_OLD NAME float_types_non_opt)
boost_lexical_cast_add_test_impl(lexical_cast_float_types_non_opt float_types_test.cpp Boost::lexical_cast)
target_compile_definitions(lexical_cast_float_types_non_opt PRIVATE BOOST_LEXICAL_CAST_DETAIL_TEST_ON_OLD)
endif()
boost_test(TYPE run SOURCES inf_nan_test.cpp)
boost_test(TYPE run SOURCES containers_test.cpp)
boost_test(TYPE run SOURCES empty_input_test.cpp LINK_LIBRARIES Boost::range)
boost_test(TYPE run SOURCES pointers_test.cpp)
boost_lexical_cast_add_test(inf_nan_test "")
boost_lexical_cast_add_test(containers_test "")
boost_lexical_cast_add_test(empty_input_test Boost::range)
boost_lexical_cast_add_test(pointers_test "")
if(MSVC)
boost_test(TYPE compile SOURCES typedefed_wchar_test.cpp COMPILE_OPTIONS "/Zc:wchar_t-")
boost_test(TYPE run SOURCES typedefed_wchar_test_runtime.cpp COMPILE_OPTIONS "/Zc:wchar_t-")
add_executable(lexical_cast_typedefed_wchar_test_compile typedefed_wchar_test.cpp)
target_compile_options(lexical_cast_typedefed_wchar_test_compile PRIVATE "/Zc:wchar_t-")
boost_lexical_cast_add_test(typedefed_wchar_test_runtime "")
target_compile_options(lexical_cast_typedefed_wchar_test_runtime PRIVATE "/Zc:wchar_t-")
endif()
boost_test(TYPE run SOURCES no_locale_test.cpp
COMPILE_DEFINITIONS BOOST_NO_STD_LOCALE BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
LINK_LIBRARIES Boost::range
boost_lexical_cast_add_test(no_locale_test Boost::range)
target_compile_definitions(lexical_cast_no_locale_test
PRIVATE
BOOST_NO_STD_LOCALE
BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
)
boost_test(TYPE run SOURCES no_exceptions_test.cpp
COMPILE_OPTIONS "-fno-exceptions"
COMPILE_DEFINITIONS
_HAS_EXCEPTIONS=0 # MSVC stdlib
_STLP_NO_EXCEPTIONS # STLPort
LINK_LIBRARIES Boost::range
boost_lexical_cast_add_test_impl(lexical_cast_no_exceptions_test no_exceptions_test.cpp "Boost::container;Boost::range")
target_include_directories(lexical_cast_no_exceptions_test PRIVATE ../include)
target_compile_definitions(lexical_cast_no_exceptions_test
PRIVATE
_HAS_EXCEPTIONS=0 # MSVC stdlib
_STLP_NO_EXCEPTIONS # STLPort
)
if(MSVC)
target_compile_definitions(lexical_cast_no_exceptions_test PRIVATE BOOST_NO_EXCEPTIONS)
endif()
target_compile_options(lexical_cast_no_exceptions_test PRIVATE "-fno-exceptions")
boost_test(TYPE run SOURCES iterator_range_test.cpp LINK_LIBRARIES Boost::range)
boost_test(TYPE run SOURCES string_view_test.cpp LINK_LIBRARIES Boost::utility)
boost_test(TYPE run SOURCES arrays_test.cpp LINK_LIBRARIES Boost::array)
boost_test(TYPE run SOURCES integral_types_test.cpp LINK_LIBRARIES Boost::type_traits)
boost_test(TYPE run SOURCES stream_detection_test.cpp)
boost_test(TYPE run SOURCES stream_traits_test.cpp LINK_LIBRARIES Boost::array Boost::range Boost::utility)
boost_lexical_cast_add_test(iterator_range_test Boost::range)
boost_lexical_cast_add_test(string_view_test Boost::utility)
boost_lexical_cast_add_test(arrays_test Boost::array)
boost_lexical_cast_add_test(integral_types_test Boost::type_traits)
boost_lexical_cast_add_test(stream_detection_test "")
boost_lexical_cast_add_test(stream_traits_test "Boost::array;Boost::range;Boost::utility")
boost_test(TYPE compile-fail SOURCES to_pointer_test.cpp)
boost_test(TYPE compile-fail SOURCES from_volatile.cpp)
boost_test(TYPE run SOURCES filesystem_test.cpp LINK_LIBRARIES Boost::filesystem)
boost_test(TYPE run SOURCES try_lexical_convert.cpp)
boost_lexical_cast_add_test(filesystem_test Boost::filesystem)
boost_lexical_cast_add_test(try_lexical_convert "")
file(GLOB EXAMPLE_FILES "../example/*.cpp")
foreach (testsourcefile ${EXAMPLE_FILES})
boost_test(TYPE run SOURCES ${testsourcefile} LINK_LIBRARIES Boost::variant Boost::date_time)
get_filename_component(testname ${testsourcefile} NAME_WE)
boost_lexical_cast_add_test_impl(lexical_cast_example_${testname} ${testsourcefile} "Boost::variant;Boost::date_time")
endforeach()
+1 -1
View File
@@ -1,5 +1,5 @@
# Copyright (C) 2001-2003 Douglas Gregor
# Copyright (C) Antony Polukhin, 2011-2024
# Copyright Antony Polukhin, 2011-2026.
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+3 -3
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Sergey Shandar 2005, Alexander Nasonov, 2007.
// Copyright Antony Polukhin, 2023-2025.
// Copyright Antony Polukhin, 2023-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -12,10 +12,10 @@
// Test abstract class. Bug 1358600:
// http://sf.net/tracker/?func=detail&aid=1358600&group_id=7586&atid=107586
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/lexical_cast.hpp>
class A
{
public:
+1 -1
View File
@@ -2,7 +2,7 @@
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Copyright Antony Polukhin, 2016-2025.
# Copyright Antony Polukhin, 2016-2026.
#
# See https://svn.boost.org/trac/boost/wiki/TravisCoverals for description of this file
+10 -5
View File
@@ -2,18 +2,18 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2012-2025.
// Copyright Antony Polukhin, 2012-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/array.hpp>
#include <boost/lexical_cast.hpp>
using namespace boost;
#if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(_LIBCPP_VERSION) && !defined(BOOST_MSVC)
@@ -61,7 +61,7 @@ static void testing_template_array_output_on_spec_value(T val)
BOOST_TEST_THROWS(lexical_cast<sshort_arr_type>(val), boost::bad_lexical_cast);
}
#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING)
#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) && !defined(_LIBCPP_VERSION)
typedef ArrayT<wchar_t, 300> warr_type;
typedef ArrayT<wchar_t, 3> wshort_arr_type;
std::wstring wethalon(L"100");
@@ -156,7 +156,7 @@ static void testing_template_array_output_on_char_value()
BOOST_TEST_THROWS(lexical_cast<sshort_arr_type>(val), boost::bad_lexical_cast);
}
#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING)
#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) && !defined(_LIBCPP_VERSION)
typedef ArrayT<wchar_t, 4> warr_type;
typedef ArrayT<wchar_t, 3> wshort_arr_type;
std::wstring wethalon(L"100");
@@ -238,11 +238,13 @@ static void testing_template_array_output_on_char_value()
void testing_boost_array_output_conversion()
{
#ifndef _LIBCPP_VERSION
testing_template_array_output_on_char_value<boost::array>();
testing_template_array_output_on_spec_value<boost::array>(100);
testing_template_array_output_on_spec_value<boost::array>(static_cast<short>(100));
testing_template_array_output_on_spec_value<boost::array>(static_cast<unsigned short>(100));
testing_template_array_output_on_spec_value<boost::array>(static_cast<unsigned int>(100));
#endif
}
void testing_std_array_output_conversion()
@@ -344,7 +346,10 @@ static void testing_generic_array_input_conversion()
void testing_boost_array_input_conversion()
{
#ifndef _LIBCPP_VERSION
testing_generic_array_input_conversion<boost::array>();
#endif
BOOST_TEST(true);
}
void testing_std_array_input_conversion()
+80
View File
@@ -0,0 +1,80 @@
# Copyright (c) 2016-2025 Antony Polukhin
# Copyright (c) 2025-2026 Fedor Osetrov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...4.0)
project(lexical_cast_subdir_test LANGUAGES CXX)
set(deps
# Library dependencies
config
container
core
throw_exception
# Test dependencies
algorithm
array
align
assert
atomic
bind
compat
concept_check
container_hash
conversion
date_time
describe
detail
exception
filesystem
function
function_types
functional
fusion
integer
intrusive
io
iterator
move
mp11
mpl
numeric/conversion
optional
predef
preprocessor
range
regex
scope
smart_ptr
static_assert
system
test
tokenizer
tuple
type_index
type_traits
typeof
unordered
utility
variant
variant2
winapi
)
foreach(dep IN LISTS deps)
add_subdirectory(../../../${dep} boostorg/${dep})
endforeach()
enable_testing()
add_subdirectory(../../ boostorg/lexical_cast)
if (BOOST_USE_MODULES)
add_executable(boost_lexical_cast_module_usage ../modules/usage_sample.cpp)
target_link_libraries(boost_lexical_cast_module_usage PRIVATE Boost::lexical_cast)
add_test(NAME boost_lexical_cast_module_usage COMMAND boost_lexical_cast_module_usage)
endif()
+3 -3
View File
@@ -2,17 +2,17 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/container/string.hpp>
#include <boost/lexical_cast.hpp>
using namespace boost;
void testing_boost_containers_basic_string()
+5 -4
View File
@@ -2,21 +2,22 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/lexical_cast.hpp>
#include <boost/range/iterator_range.hpp>
#include "escape_struct.hpp"
#include <boost/core/lightweight_test.hpp>
#include <vector>
#include <boost/lexical_cast.hpp>
#include "escape_struct.hpp"
using namespace boost;
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
+1 -1
View File
@@ -1,6 +1,6 @@
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2020.
// Copyright Antony Polukhin, 2020-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
+3 -3
View File
@@ -2,7 +2,7 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2013-2025.
// Copyright Antony Polukhin, 2013-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -10,11 +10,11 @@
//
// Test lexical_cast usage with long filesystem::path. Bug 7704.
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/lexical_cast.hpp>
void test_filesystem()
{
boost::filesystem::path p;
+13 -9
View File
@@ -2,24 +2,27 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#ifndef BOOST_LEXICAL_CAST_DETAIL_TEST_ON_OLD
#include <boost/lexical_cast.hpp>
#else
// Make sure that tests work the same way on non-optimized version
#include "lexical_cast_old.hpp"
#endif
#include <sstream>
#include <type_traits>
#include <boost/cstdint.hpp>
#include <boost/core/lightweight_test.hpp>
#ifndef BOOST_LEXICAL_CAST_DETAIL_TEST_ON_OLD
#include <boost/lexical_cast/detail/type_traits.hpp>
#include <boost/lexical_cast.hpp>
#else
// Make sure that tests work the same way on non-optimized version
#include "lexical_cast_old.hpp"
#include <boost/lexical_cast/detail/type_traits.hpp>
#endif
#ifndef BOOST_TEST_CLOSE_FRACTION
// Naiive, but works for most tests in this file
@@ -303,7 +306,7 @@ void test_float_typess_for_overflows()
BOOST_TEST_THROWS(lexical_cast<test_t>("1"+s_max_value), bad_lexical_cast);
BOOST_TEST_THROWS(lexical_cast<test_t>("9"+s_max_value), bad_lexical_cast);
#endif
#if !(defined(_LIBCPP_VERSION) && defined(BOOST_LEXICAL_CAST_DETAIL_TEST_ON_OLD))
if ( std::is_same<test_t,float>::value )
{
BOOST_TEST_THROWS(lexical_cast<test_t>( (std::numeric_limits<double>::max)() ), bad_lexical_cast);
@@ -339,6 +342,7 @@ void test_float_typess_for_overflows()
<= (std::numeric_limits<long double>::min)() / 2 + std::numeric_limits<test_t>::epsilon()
);
}
#endif
}
#undef CHECK_CLOSE_ABS_DIFF
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2013-2025.
// Copyright Antony Polukhin, 2013-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
+3 -3
View File
@@ -1,13 +1,13 @@
// Copyright Antony Polukhin, 2023-2025.
// Copyright Antony Polukhin, 2023-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/lexical_cast.hpp>
struct oops {
operator int () const {
return 41;
+3 -3
View File
@@ -2,7 +2,7 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -10,12 +10,12 @@
#include <type_traits>
#include <boost/lexical_cast.hpp>
#include <boost/core/cmath.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/lexical_cast.hpp>
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
#define BOOST_LCAST_NO_WCHAR_T
#endif
+4 -3
View File
@@ -4,7 +4,7 @@
//
// Copyright Terje Sletteb and Kevlin Henney, 2005.
// Copyright Alexander Nasonov, 2006.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -19,8 +19,6 @@
//
#define _SCL_SECURE_NO_WARNINGS
#include <boost/lexical_cast.hpp>
#include <boost/cstdint.hpp>
#include <boost/core/lightweight_test.hpp>
@@ -29,10 +27,13 @@
#include <boost/type_traits/integral_promotion.hpp>
#include <string>
#include <sstream>
#include <vector>
#include <memory>
#include <type_traits>
#include <boost/lexical_cast.hpp>
#if (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64)) \
&& !(defined(BOOST_MSVC) && BOOST_MSVC < 1300)
#define LCAST_TEST_LONGLONG
+5 -5
View File
@@ -2,19 +2,19 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2012-2025.
// Copyright Antony Polukhin, 2012-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/lexical_cast.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/lexical_cast.hpp>
using namespace boost;
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
@@ -136,7 +136,7 @@ void test_it_range_using_char(CharT* one, CharT* eleven)
#endif
BOOST_TEST_EQ(lexical_cast<class_with_user_defined_sream_operators>(crng2), 1);
#ifndef BOOST_LCAST_NO_WCHAR_T
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(_LIBCPP_VERSION)
BOOST_TEST(lexical_cast<std::wstring>(rng1) == L"1");
BOOST_TEST(lexical_cast<std::wstring>(crng1) == L"1");
BOOST_TEST(lexical_cast<std::wstring>(rng2) == L"1");
@@ -191,7 +191,7 @@ void test_signed_char_iterator_ranges()
void test_wchar_iterator_ranges()
{
#ifndef BOOST_LCAST_NO_WCHAR_T
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(_LIBCPP_VERSION)
typedef wchar_t test_char_type;
test_char_type data1[] = L"1";
test_char_type data2[] = L"11";
+5 -2
View File
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -34,7 +34,6 @@
#include <cstdio>
#include <type_traits>
#include <boost/limits.hpp>
#include <boost/detail/lcast_precision.hpp>
#include <boost/config/workaround.hpp>
#ifdef BOOST_NO_STRINGSTREAM
@@ -43,6 +42,10 @@
#include <sstream>
#endif
#if defined(BOOST_USE_MODULES)
#undef BOOST_USE_MODULES
#endif
#include <boost/lexical_cast/detail/lcast_precision.hpp>
#include <boost/lexical_cast/bad_lexical_cast.hpp>
#include <boost/lexical_cast/detail/widest_char.hpp>
+7 -3
View File
@@ -4,7 +4,7 @@
//
// Copyright Terje Sletteb and Kevlin Henney, 2005.
// Copyright Alexander Nasonov, 2006.
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -19,8 +19,6 @@
//
#define _SCL_SECURE_NO_WARNINGS
#include <boost/lexical_cast.hpp>
#include <boost/cstdint.hpp>
#include <boost/core/lightweight_test.hpp>
@@ -31,6 +29,8 @@
#include <algorithm> // std::transform
#include <memory>
#include <boost/lexical_cast.hpp>
#if (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64)) \
&& !(defined(BOOST_MSVC) && BOOST_MSVC < 1300)
#define LCAST_TEST_LONGLONG
@@ -528,8 +528,10 @@ void test_char16_conversions()
// There's no std::ctype<char16_t> in Xcode_15.0.1
#if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(__APPLE__)
BOOST_TEST(u"100" == lexical_cast<std::u16string>(u"100"));
#if !defined(_LIBCPP_VERSION) // libc++ also does not have std::ctype<char16_t>
BOOST_TEST(u"1" == lexical_cast<std::u16string>(u'1'));
#endif
#endif
}
void test_char32_conversions()
@@ -537,8 +539,10 @@ void test_char32_conversions()
// There's no std::ctype<char32_t> in Xcode_15.0.1
#if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(__APPLE__)
BOOST_TEST(U"100" == lexical_cast<std::u32string>(U"100"));
#if !defined(_LIBCPP_VERSION) // libc++ also does not have std::ctype<char32_t>
BOOST_TEST(U"1" == lexical_cast<std::u32string>(U'1'));
#endif
#endif
}
void test_getting_pointer_to_function()
+3 -3
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Alexander Nasonov, 2006.
// Copyright Antony Polukhin, 2023-2025.
// Copyright Antony Polukhin, 2023-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -12,10 +12,10 @@
// Test round-tripping conversion FPT -> string -> FPT,
// where FPT is Floating Point Type.
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/lexical_cast.hpp>
#if (defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__NetBSD__) \
|| (defined(__hppa) && !defined(__OpenBSD__)) || (defined(__NO_LONG_DOUBLE_MATH) && (DBL_MANT_DIG != LDBL_MANT_DIG))) \
|| defined(__MINGW64__)
+6 -2
View File
@@ -2,7 +2,7 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2012-2025.
// Copyright Antony Polukhin, 2012-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -16,12 +16,16 @@
#pragma warning(disable: 4097 4100 4121 4127 4146 4244 4245 4511 4512 4701 4800)
#endif
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/range/iterator_range.hpp>
#include <cstdlib>
#if defined(BOOST_USE_MODULES)
#undef BOOST_USE_MODULES
#endif
#include <boost/lexical_cast.hpp>
#include "escape_struct.hpp"
#ifndef BOOST_NO_EXCEPTIONS
+3 -3
View File
@@ -2,14 +2,12 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2012-2025.
// Copyright Antony Polukhin, 2012-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/range/iterator_range.hpp>
@@ -17,6 +15,8 @@
#include <vector>
#include <boost/lexical_cast.hpp>
using namespace boost;
// Testing compilation and some basic usage with BOOST_NO_STD_LOCALE
+3 -2
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Alexander Nasonov, 2007.
// Copyright Antony Polukhin, 2023-2025.
// Copyright Antony Polukhin, 2023-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -11,11 +11,12 @@
//
// Test that Source can be non-copyable.
#include <boost/lexical_cast.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/lexical_cast.hpp>
class Noncopyable : private boost::noncopyable
{
public:
+5 -3
View File
@@ -2,16 +2,18 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2012-2025.
// Copyright Antony Polukhin, 2012-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#include <sstream>
#include <boost/lexical_cast.hpp>
#if defined(BOOST_NO_STRINGSTREAM)
typedef std::strstream ss_t;
#else
+3 -3
View File
@@ -2,19 +2,19 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#include <iostream>
#include <type_traits>
#include <boost/lexical_cast.hpp>
///////////////////////// char streamable classes ///////////////////////////////////////////
+4 -1
View File
@@ -1,9 +1,12 @@
// Copyright Antony Polukhin, 2012-2025.
// Copyright Antony Polukhin, 2012-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#if defined(BOOST_USE_MODULES)
#undef BOOST_USE_MODULES
#endif
#include <boost/lexical_cast/detail/converter_lexical.hpp>
#include <boost/core/lightweight_test.hpp>
+3 -3
View File
@@ -2,15 +2,13 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2012-2025.
// Copyright Antony Polukhin, 2012-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/lexical_cast.hpp>
#include <boost/utility/string_view.hpp>
#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW
@@ -19,6 +17,8 @@
#include <boost/core/lightweight_test.hpp>
#include <boost/lexical_cast.hpp>
template <class StringView>
void test_string_view_conversion() {
+1 -1
View File
@@ -2,7 +2,7 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2013-2025.
// Copyright Antony Polukhin, 2013-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
+3 -3
View File
@@ -2,16 +2,16 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2014-2025.
// Copyright Antony Polukhin, 2014-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/lexical_cast/try_lexical_convert.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/lexical_cast/try_lexical_convert.hpp>
using namespace boost::conversion;
void try_uncommon_cases()
+1 -1
View File
@@ -2,7 +2,7 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
+1 -1
View File
@@ -2,7 +2,7 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
+3 -1
View File
@@ -12,12 +12,14 @@
// implementation has changed and it does not use stringstream for casts
// to integral types
#include <boost/lexical_cast.hpp>
#include <boost/cstdint.hpp>
#include <boost/core/lightweight_test.hpp>
#include <string>
#include <sstream>
#include <boost/lexical_cast.hpp>
#ifdef BOOST_MSVC
# pragma warning(disable: 4127) // conditional expression is constant
+7 -2
View File
@@ -2,15 +2,20 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2011-2025.
// Copyright Antony Polukhin, 2011-2026.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
#include <boost/core/lightweight_test.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/core/lightweight_test.hpp>
#if defined(BOOST_USE_MODULES)
#undef BOOST_USE_MODULES
#endif
#include <boost/lexical_cast/detail/lcast_char_constants.hpp>
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
#define BOOST_LCAST_NO_WCHAR_T