From 28a356cc28877937bd29359ea5fa7daf04bd4d98 Mon Sep 17 00:00:00 2001 From: Kris Jusiak Date: Wed, 24 May 2023 15:12:23 -0500 Subject: [PATCH] v1.3 --- Makefile | 2 +- README.md | 2 +- doc/CHANGELOG.md | 4 + doc/scripts/update_readme_toc.py | 2 +- include/boost/di.hpp | 169 ++++++++++++++++--------------- 5 files changed, 95 insertions(+), 84 deletions(-) diff --git a/Makefile b/Makefile index d7651029a1..74ea4a78f4 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ CMAKE_GENERATOR?=Unix Makefiles TOOLSET?=clang CLANG_FORMAT?=clang-format CLANG_TIDY?=clang-tidy -PYTHON?=python2 +PYTHON?=python3 MKDOCS?=mkdocs MKDOCS_THEME?=boost-modern MKDOCS_SITE?=site diff --git a/README.md b/README.md index de4789697b..8fbfa8a5eb 100644 --- a/README.md +++ b/README.md @@ -437,6 +437,7 @@ retq * [Shared Scope](https://boost-ext.github.io/di/extensions.html#shared-scope) * [FAQ](https://boost-ext.github.io/di/FAQ.html) * [CHANGELOG](https://boost-ext.github.io/di/CHANGELOG.html) + * [[1.3.0] - 2023-05-23](https://boost-ext.github.io/di/CHANGELOG.html#130-2023-05-23) * [[1.2.0] - 2020-07-21](https://boost-ext.github.io/di/CHANGELOG.html#120-2020-07-21) * [[1.1.0] - 2019-01-07](https://boost-ext.github.io/di/CHANGELOG.html#110-2019-01-07) * [[1.0.2] - 2018-01-04](https://boost-ext.github.io/di/CHANGELOG.html#102-2018-01-04) @@ -444,7 +445,6 @@ retq * [[1.0.0] - 2016-02-22](https://boost-ext.github.io/di/CHANGELOG.html#100-2016-02-22) * [[0.5.0] - 2015-01-12](https://boost-ext.github.io/di/CHANGELOG.html#050-2015-01-12) * [[0.1.0] - 2014-08-15](https://boost-ext.github.io/di/CHANGELOG.html#010-2014-08-15) - [](GENERATE_TOC_END) --- diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 1b6f595d32..ba23e1fafc 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.3.0] - 2023-05-23 +- **Bug Fixes** + - [Issues](https://github.com/boost-ext/di/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aclosed+closed%3A2020-07-21..2023-05-23+) +> ## [1.2.0] - 2020-07-21 - **Additions** - Support for Clang-9/Clang-10/XCode-11 diff --git a/doc/scripts/update_readme_toc.py b/doc/scripts/update_readme_toc.py index 0d69953c4c..b91582626c 100644 --- a/doc/scripts/update_readme_toc.py +++ b/doc/scripts/update_readme_toc.py @@ -20,7 +20,7 @@ for line in md: if line.startswith('##'): name = line.replace('# ', '').replace('#', '')[:-1] - id = filter(lambda c: c == '-' or c == '_' or str.isalnum(c), name.lower().replace(" ", "-")).replace("--", "") + id = ''.join(filter(lambda c: c == '-' or c == '_' or str.isalnum(c), name.lower().replace(" ", "-"))).replace("--", "") print(' * [' + name + '](' + sys.argv[4] + '/' + index[1][1:-4] + ext + "#" + id + ')') print elif line.startswith('[](GENERATE_TOC_END)'): diff --git a/include/boost/di.hpp b/include/boost/di.hpp index d452ac040e..e06a665353 100644 --- a/include/boost/di.hpp +++ b/include/boost/di.hpp @@ -8,12 +8,12 @@ #if (__cplusplus < 201305L && _MSC_VER < 1900) #error "[Boost::ext].DI requires C++14 support (Clang-3.4+, GCC-5.1+, MSVC-2015+)" #else -#define BOOST_DI_VERSION 1'2'0 +#define BOOST_DI_VERSION 1'3'0 #define BOOST_DI_NAMESPACE_BEGIN \ namespace boost { \ inline namespace ext { \ namespace di { \ - inline namespace v1_2_0 { + inline namespace v1_3_0 { #define BOOST_DI_NAMESPACE_END \ } \ } \ @@ -286,7 +286,9 @@ template using make_index_sequence = typename make_index_sequence_impl::type; } namespace placeholders { -__BOOST_DI_UNUSED static const struct arg { } _{}; } +__BOOST_DI_UNUSED static const struct arg { +} _{}; +} template struct named {}; struct no_name { @@ -342,8 +344,8 @@ class instance; class singleton; class unique; } -#define __BOOST_DI_REQUIRES(...) typename ::boost::ext::di::v1_2_0::aux::enable_if<__VA_ARGS__, int>::type -#define __BOOST_DI_REQUIRES_MSG(...) typename ::boost::ext::di::v1_2_0::aux::concept_check<__VA_ARGS__>::type +#define __BOOST_DI_REQUIRES(...) typename ::boost::ext::di::v1_3_0::aux::enable_if<__VA_ARGS__, int>::type +#define __BOOST_DI_REQUIRES_MSG(...) typename ::boost::ext::di::v1_3_0::aux::concept_check<__VA_ARGS__>::type namespace aux { template T&& declval(); @@ -622,14 +624,14 @@ using unique_t = typename unique, Ts...>::type; false_type has_shared_ptr__(...); #if !defined(BOOST_DI_DISABLE_SHARED_PTR_DEDUCTION) template -auto has_shared_ptr__(T &&) -> is_valid_expr{})>; +auto has_shared_ptr__(T&&) -> is_valid_expr{})>; #endif template -decltype(::boost::ext::di::v1_2_0::aux::declval().operator()(::boost::ext::di::v1_2_0::aux::declval()...), - ::boost::ext::di::v1_2_0::aux::true_type()) +decltype(::boost::ext::di::v1_3_0::aux::declval().operator()(::boost::ext::di::v1_3_0::aux::declval()...), + ::boost::ext::di::v1_3_0::aux::true_type()) is_invocable_impl(int); template -::boost::ext::di::v1_2_0::aux::false_type is_invocable_impl(...); +::boost::ext::di::v1_3_0::aux::false_type is_invocable_impl(...); template struct is_invocable : decltype(is_invocable_impl(0)) {}; struct callable_base_impl { @@ -794,9 +796,9 @@ template struct is_abstract { static constexpr auto value = aux::is_abstract::value; }; -auto boundable_impl(any_of<> &&) -> aux::true_type; +auto boundable_impl(any_of<>&&) -> aux::true_type; template -auto boundable_impl(any_of &&) +auto boundable_impl(any_of&&) -> aux::conditional_t>::value, decltype(boundable_impl(aux::declval>())), typename type_::has_disallowed_qualifiers>; template @@ -805,25 +807,25 @@ using boundable_impl__ = aux::conditional_t< aux::conditional_t::value, T>::value, typename type_::is_abstract, aux::true_type>, typename type_::template is_not_related_to>; template -auto boundable_impl(I&&, T &&) -> aux::conditional_t>::value || !aux::is_complete::value, - boundable_impl__, typename type_::has_disallowed_qualifiers>; +auto boundable_impl(I&&, T&&) -> aux::conditional_t>::value || !aux::is_complete::value, + boundable_impl__, typename type_::has_disallowed_qualifiers>; template -auto boundable_impl(I&&, T&&, aux::valid<> &&) +auto boundable_impl(I&&, T&&, aux::valid<>&&) -> aux::conditional_t::value && aux::is_complete::value, I, T>::value, aux::true_type, typename type_::template is_not_related_to>; template -auto boundable_impl(I* [], T &&) -> aux::conditional_t>::value, boundable_impl__, - typename type_::has_disallowed_qualifiers>; -template -auto boundable_impl(I[], T &&) -> aux::conditional_t>::value, boundable_impl__, +auto boundable_impl(I*[], T&&) -> aux::conditional_t>::value, boundable_impl__, typename type_::has_disallowed_qualifiers>; +template +auto boundable_impl(I[], T&&) -> aux::conditional_t>::value, boundable_impl__, + typename type_::has_disallowed_qualifiers>; template -auto boundable_impl(aux::type_list &&) -> boundable_bindings; +auto boundable_impl(aux::type_list&&) -> boundable_bindings; template -auto boundable_impl(concepts::any_of&&, T &&) -> +auto boundable_impl(concepts::any_of&&, T&&) -> typename get_any_of_error(), aux::declval()))...>::type; template -auto boundable_impl(aux::type &&) -> typename get_is_unique_error_impl::type>::type; +auto boundable_impl(aux::type&&) -> typename get_is_unique_error_impl::type>::type; aux::true_type boundable_impl(...); template struct boundable__ { @@ -916,7 +918,7 @@ typename scope::template requires_::is_referable, typena typename scope<_, _>::create> scopable_impl(...); template -auto scopable_impl(T &&) +auto scopable_impl(T&&) -> aux::is_valid_expr::template is_referable<_, config__<_>>, decltype(T::template scope<_, _>::template try_create<_, _>(provider__<_>{})), decltype(aux::declval>().template create<_, _>(provider__<_>{}))>; @@ -952,10 +954,10 @@ struct pool> : TArgs... { #endif namespace type_traits { template -struct is_injectable : ::boost::ext::di::v1_2_0::aux::false_type {}; +struct is_injectable : ::boost::ext::di::v1_3_0::aux::false_type {}; template -struct is_injectable> - : ::boost::ext::di::v1_2_0::aux::true_type {}; +struct is_injectable> + : ::boost::ext::di::v1_3_0::aux::true_type {}; struct direct {}; struct uniform {}; template @@ -1352,7 +1354,7 @@ struct unique { inline operator I() const noexcept { return object; } - inline operator T &&() noexcept { return static_cast(object); } + inline operator T&&() noexcept { return static_cast(object); } T object; }; template @@ -1412,14 +1414,13 @@ struct wrapper_traits> { template using wrapper_traits_t = typename wrapper_traits::type; template -struct has_result_type : ::boost::ext::di::v1_2_0::aux::false_type {}; +struct has_result_type : ::boost::ext::di::v1_3_0::aux::false_type {}; template -struct has_result_type> - : ::boost::ext::di::v1_2_0::aux::true_type {}; +struct has_result_type> + : ::boost::ext::di::v1_3_0::aux::true_type {}; template -struct is_expr - : aux::integral_constant< - bool, aux::is_invocable::value && !has_result_type::value> {}; +struct is_expr : aux::integral_constant::value && + !has_result_type::value> {}; } template struct wrapper { @@ -1541,7 +1542,7 @@ class instance { template struct injector__> { T (*f)(const injector__*) = nullptr; - explicit injector__(const decltype(f) & ptr) : f(ptr) {} + explicit injector__(const decltype(f)& ptr) : f(ptr) {} }; struct injector : injector__... { void (*dtor)(injector*) = nullptr; @@ -1655,8 +1656,8 @@ class dependency : dependency_base, friend class dependency; using scope_t = typename TScope::template scope; template - using externable = aux::integral_constant< - bool, aux::always::value && aux::is_same::value && aux::is_same::value>; + using externable = aux::integral_constant::value && aux::is_same::value && + aux::is_same::value>; template struct ref_traits { using type = T; @@ -1706,7 +1707,7 @@ class dependency : dependency_base, return dependency{static_cast(*this)}; } template ) = 0> - auto in(const T&)noexcept { + auto in(const T&) noexcept { return dependency{}; } template ::value) = 0, @@ -1950,7 +1951,7 @@ struct scope_traits> { }; } #if !defined(BOOST_DI_CFG) -#define BOOST_DI_CFG ::boost::ext::di::v1_2_0::config +#define BOOST_DI_CFG ::boost::ext::di::v1_3_0::config #endif template ) = 0> inline auto make_policies(TPolicies... args) noexcept { @@ -2042,8 +2043,8 @@ struct injector { }; aux::false_type configurable_impl(...); template -auto configurable_impl(T &&) -> aux::is_valid_expr().provider((injector*)0)), - decltype(aux::declval().policies((injector*)0))>; +auto configurable_impl(T&&) -> aux::is_valid_expr().provider((injector*)0)), + decltype(aux::declval().policies((injector*)0))>; template struct get_configurable_error : aux::type_list {}; template @@ -2175,7 +2176,7 @@ struct any_type_ref { } template ::value), class = __BOOST_DI_REQUIRES(is_creatable__::value)> - operator T &&() const { + operator T&&() const { return static_cast&>(injector_).create_impl(aux::type{}); } template ::value), @@ -2209,7 +2210,7 @@ struct any_type_1st_ref { template ::value), class = __BOOST_DI_REQUIRES(is_referable__::value), class = __BOOST_DI_REQUIRES(is_creatable__::value)> - operator T &&() const { + operator T&&() const { return static_cast&>(injector_).create_impl(aux::type{}); } template ::value), @@ -2242,7 +2243,7 @@ struct any_type_ref { return static_cast&>(injector_).create_successful_impl(aux::type{}); } template ::value)> - operator T &&() const { + operator T&&() const { return static_cast&>(injector_).create_successful_impl(aux::type{}); } template ::value)> @@ -2271,7 +2272,7 @@ struct any_type_1st_ref { } template ::value), class = __BOOST_DI_REQUIRES(is_referable__::value)> - operator T &&() const { + operator T&&() const { return static_cast&>(injector_).create_successful_impl(aux::type{}); } template ::value), @@ -2303,7 +2304,7 @@ struct any_type_ref_fwd { template operator T&() const; template - operator T &&() const; + operator T&&() const; template operator const T&() const; }; @@ -2323,7 +2324,7 @@ struct any_type_1st_ref_fwd { template ::value)> operator T&() const; template ::value)> - operator T &&() const; + operator T&&() const; template ::value)> operator const T&() const; }; @@ -2555,7 +2556,7 @@ class injector : public injector_base, public pool> { template