mirror of
https://github.com/boostorg/convert.git
synced 2026-07-21 13:13:37 +00:00
Merge branch 'develop'
This commit is contained in:
+612
-380
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
# Copyright René Ferdinand Rivera Morell 2024
|
||||
# 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)
|
||||
|
||||
require-b2 5.2 ;
|
||||
|
||||
constant boost_dependencies :
|
||||
/boost/config//boost_config
|
||||
/boost/core//boost_core
|
||||
/boost/function_types//boost_function_types
|
||||
/boost/lexical_cast//boost_lexical_cast
|
||||
/boost/math//boost_math_tr1
|
||||
/boost/mpl//boost_mpl
|
||||
/boost/optional//boost_optional
|
||||
/boost/parameter//boost_parameter
|
||||
/boost/range//boost_range
|
||||
/boost/spirit//boost_spirit
|
||||
/boost/type_traits//boost_type_traits ;
|
||||
|
||||
project /boost/convert
|
||||
: common-requirements
|
||||
<include>include
|
||||
;
|
||||
|
||||
explicit
|
||||
[ alias boost_convert : : : : <library>$(boost_dependencies) ]
|
||||
[ alias all : boost_convert example test ]
|
||||
;
|
||||
|
||||
call-if : boost-library convert
|
||||
;
|
||||
|
||||
@@ -8,6 +8,7 @@ import testing ;
|
||||
|
||||
project convert_examples
|
||||
: requirements
|
||||
<library>/boost/convert//boost_convert
|
||||
<warnings>on
|
||||
<toolset>gcc:<warnings>all
|
||||
<toolset>msvc:<warnings>all
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef BOOST_CONVERT_HAS_MEMBER_HPP
|
||||
#define BOOST_CONVERT_HAS_MEMBER_HPP
|
||||
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/detail/yes_no_type.hpp>
|
||||
|
||||
// This macro allows to check if a type has a member named "__member_name__"...
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef BOOST_CONVERT_IS_CALLABLE_HPP
|
||||
#define BOOST_CONVERT_IS_CALLABLE_HPP
|
||||
|
||||
#include <boost/type_traits/decay.hpp>
|
||||
#include <boost/convert/detail/has_member.hpp>
|
||||
|
||||
namespace boost { namespace cnv { namespace detail
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Copyright 2018, 2019 Peter Dimov
|
||||
# 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...3.31)
|
||||
|
||||
project(cmake_install_test LANGUAGES CXX)
|
||||
|
||||
find_package(boost_convert REQUIRED)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(main Boost::convert)
|
||||
|
||||
enable_testing()
|
||||
add_test(main main)
|
||||
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2026 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/convert.hpp>
|
||||
#include <boost/convert/stream.hpp>
|
||||
#include <string>
|
||||
|
||||
struct boost::cnv::by_default: boost::cnv::cstream {};
|
||||
|
||||
int main()
|
||||
{
|
||||
int x = boost::convert<int>( "14" ).value_or( -1 );
|
||||
return x == 14? 0: 1;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
# Copyright 2018, 2019 Peter Dimov
|
||||
# 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...3.31)
|
||||
|
||||
project(cmake_subdir_test LANGUAGES CXX)
|
||||
|
||||
set(BOOST_INCLUDE_LIBRARIES convert)
|
||||
add_subdirectory(../../../.. boostorg/boost)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(main Boost::convert)
|
||||
|
||||
enable_testing()
|
||||
add_test(main main)
|
||||
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2026 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/convert.hpp>
|
||||
#include <boost/convert/stream.hpp>
|
||||
#include <string>
|
||||
|
||||
struct boost::cnv::by_default: boost::cnv::cstream {};
|
||||
|
||||
int main()
|
||||
{
|
||||
int x = boost::convert<int>( "14" ).value_or( -1 );
|
||||
return x == 14? 0: 1;
|
||||
}
|
||||
+12
-7
@@ -3,12 +3,17 @@
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# See copy at http://www.boost.org/LICENSE_1_0.txt.
|
||||
|
||||
require-b2 5.0.1 ;
|
||||
|
||||
import-search /boost/config/checks ;
|
||||
|
||||
# bring in the rules for testing
|
||||
import testing ;
|
||||
import ../../config/checks/config : requires ;
|
||||
import config : requires ;
|
||||
|
||||
project convert_test
|
||||
project convert_test
|
||||
: requirements
|
||||
<library>/boost/convert//boost_convert
|
||||
<warnings>on
|
||||
<toolset>icpc:<cxxflags>"-std=c++11"
|
||||
<toolset>clang:<cxxflags>"-std=c++11"
|
||||
@@ -22,9 +27,9 @@ project convert_test
|
||||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
|
||||
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
|
||||
<include>../include
|
||||
;
|
||||
;
|
||||
|
||||
exe convert_test_performance : performance.cpp /boost/timer//boost_timer /boost/chrono//boost_chrono
|
||||
exe convert_test_performance : performance.cpp /boost/timer//boost_timer /boost/chrono//boost_chrono
|
||||
: [ requires cxx17_hdr_charconv cxx17_structured_bindings cxx17_if_constexpr ] ;
|
||||
exe convert_test_performance_spirit : performance_spirit.cpp ;
|
||||
|
||||
@@ -38,15 +43,15 @@ run user_type.cpp : : : : convert_test_user_type ;
|
||||
run str_to_int.cpp : : : : convert_test_str_to_int ;
|
||||
run sfinae.cpp : : : : convert_test_sfinae ;
|
||||
run has_member.cpp : : : : convert_test_has_member ;
|
||||
run printf_converter.cpp :
|
||||
run printf_converter.cpp :
|
||||
/boost/test/included_unit_test_framework : : : convert_test_printf_converter ;
|
||||
run stream_converter.cpp :
|
||||
/boost/test/included_unit_test_framework : : : convert_test_stream_converter ;
|
||||
|
||||
# these tests require C++17
|
||||
run charconv_converter.cpp
|
||||
run charconv_converter.cpp
|
||||
: /boost/test//included_unit_test_framework
|
||||
:
|
||||
:
|
||||
: [ requires cxx17_hdr_charconv cxx17_structured_bindings cxx17_if_constexpr ]
|
||||
<toolset>gcc:<cxxflags>"-O3 -std=c++17 -Wno-unused-variable -Wno-long-long"
|
||||
: convert_test_charconv_converter ;
|
||||
|
||||
Reference in New Issue
Block a user