|
1 | | -/* auto-generated on 2023-07-23 15:03:22 -0400. Do not edit! */ |
| 1 | +/* auto-generated on 2023-08-21 14:44:25 -0400. Do not edit! */ |
2 | 2 | /* begin file include/ada.h */ |
3 | 3 | /** |
4 | 4 | * @file ada.h |
@@ -1768,8 +1768,8 @@ inline int fast_digit_count(uint32_t x) noexcept { |
1768 | 1768 | #define TL_EXPECTED_HPP |
1769 | 1769 |
|
1770 | 1770 | #define TL_EXPECTED_VERSION_MAJOR 1 |
1771 | | -#define TL_EXPECTED_VERSION_MINOR 0 |
1772 | | -#define TL_EXPECTED_VERSION_PATCH 1 |
| 1771 | +#define TL_EXPECTED_VERSION_MINOR 1 |
| 1772 | +#define TL_EXPECTED_VERSION_PATCH 0 |
1773 | 1773 |
|
1774 | 1774 | #include <exception> |
1775 | 1775 | #include <functional> |
@@ -1802,6 +1802,16 @@ inline int fast_digit_count(uint32_t x) noexcept { |
1802 | 1802 | #define TL_EXPECTED_GCC55 |
1803 | 1803 | #endif |
1804 | 1804 |
|
| 1805 | +#if !defined(TL_ASSERT) |
| 1806 | +// can't have assert in constexpr in C++11 and GCC 4.9 has a compiler bug |
| 1807 | +#if (__cplusplus > 201103L) && !defined(TL_EXPECTED_GCC49) |
| 1808 | +#include <cassert> |
| 1809 | +#define TL_ASSERT(x) assert(x) |
| 1810 | +#else |
| 1811 | +#define TL_ASSERT(x) |
| 1812 | +#endif |
| 1813 | +#endif |
| 1814 | + |
1805 | 1815 | #if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && \ |
1806 | 1816 | !defined(__clang__)) |
1807 | 1817 | // GCC < 5 doesn't support overloading on const&& for member functions |
@@ -1957,6 +1967,7 @@ template <typename E> |
1957 | 1967 | #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED |
1958 | 1968 | throw std::forward<E>(e); |
1959 | 1969 | #else |
| 1970 | + (void)e; |
1960 | 1971 | #ifdef _MSC_VER |
1961 | 1972 | __assume(0); |
1962 | 1973 | #else |
@@ -2597,7 +2608,7 @@ struct expected_operations_base : expected_storage_base<T, E> { |
2597 | 2608 | geterr().~unexpected<E>(); |
2598 | 2609 | construct(std::move(rhs).get()); |
2599 | 2610 | } else { |
2600 | | - assign_common(rhs); |
| 2611 | + assign_common(std::move(rhs)); |
2601 | 2612 | } |
2602 | 2613 | } |
2603 | 2614 |
|
@@ -2960,7 +2971,7 @@ struct default_constructor_tag { |
2960 | 2971 | }; |
2961 | 2972 |
|
2962 | 2973 | // expected_default_ctor_base will ensure that expected has a deleted default |
2963 | | -// constructor if T is not default constructible. |
| 2974 | +// consturctor if T is not default constructible. |
2964 | 2975 | // This specialization is for when T is default constructible |
2965 | 2976 | template <class T, class E, |
2966 | 2977 | bool Enable = |
@@ -3255,6 +3266,53 @@ class expected : private detail::expected_move_assign_base<T, E>, |
3255 | 3266 | return map_error_impl(std::move(*this), std::forward<F>(f)); |
3256 | 3267 | } |
3257 | 3268 | #endif |
| 3269 | +#endif |
| 3270 | +#if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \ |
| 3271 | + !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55) |
| 3272 | + template <class F> |
| 3273 | + TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) & { |
| 3274 | + return map_error_impl(*this, std::forward<F>(f)); |
| 3275 | + } |
| 3276 | + template <class F> |
| 3277 | + TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) && { |
| 3278 | + return map_error_impl(std::move(*this), std::forward<F>(f)); |
| 3279 | + } |
| 3280 | + template <class F> |
| 3281 | + constexpr auto transform_error(F &&f) const & { |
| 3282 | + return map_error_impl(*this, std::forward<F>(f)); |
| 3283 | + } |
| 3284 | + template <class F> |
| 3285 | + constexpr auto transform_error(F &&f) const && { |
| 3286 | + return map_error_impl(std::move(*this), std::forward<F>(f)); |
| 3287 | + } |
| 3288 | +#else |
| 3289 | + template <class F> |
| 3290 | + TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &>(), |
| 3291 | + std::declval<F &&>())) |
| 3292 | + transform_error(F &&f) & { |
| 3293 | + return map_error_impl(*this, std::forward<F>(f)); |
| 3294 | + } |
| 3295 | + template <class F> |
| 3296 | + TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &&>(), |
| 3297 | + std::declval<F &&>())) |
| 3298 | + transform_error(F &&f) && { |
| 3299 | + return map_error_impl(std::move(*this), std::forward<F>(f)); |
| 3300 | + } |
| 3301 | + template <class F> |
| 3302 | + constexpr decltype(map_error_impl(std::declval<const expected &>(), |
| 3303 | + std::declval<F &&>())) |
| 3304 | + transform_error(F &&f) const & { |
| 3305 | + return map_error_impl(*this, std::forward<F>(f)); |
| 3306 | + } |
| 3307 | + |
| 3308 | +#ifndef TL_EXPECTED_NO_CONSTRR |
| 3309 | + template <class F> |
| 3310 | + constexpr decltype(map_error_impl(std::declval<const expected &&>(), |
| 3311 | + std::declval<F &&>())) |
| 3312 | + transform_error(F &&f) const && { |
| 3313 | + return map_error_impl(std::move(*this), std::forward<F>(f)); |
| 3314 | + } |
| 3315 | +#endif |
3258 | 3316 | #endif |
3259 | 3317 | template <class F> |
3260 | 3318 | expected TL_EXPECTED_11_CONSTEXPR or_else(F &&f) & { |
@@ -3697,27 +3755,37 @@ class expected : private detail::expected_move_assign_base<T, E>, |
3697 | 3755 | } |
3698 | 3756 | } |
3699 | 3757 |
|
3700 | | - constexpr const T *operator->() const { return valptr(); } |
3701 | | - TL_EXPECTED_11_CONSTEXPR T *operator->() { return valptr(); } |
| 3758 | + constexpr const T *operator->() const { |
| 3759 | + TL_ASSERT(has_value()); |
| 3760 | + return valptr(); |
| 3761 | + } |
| 3762 | + TL_EXPECTED_11_CONSTEXPR T *operator->() { |
| 3763 | + TL_ASSERT(has_value()); |
| 3764 | + return valptr(); |
| 3765 | + } |
3702 | 3766 |
|
3703 | 3767 | template <class U = T, |
3704 | 3768 | detail::enable_if_t<!std::is_void<U>::value> * = nullptr> |
3705 | 3769 | constexpr const U &operator*() const & { |
| 3770 | + TL_ASSERT(has_value()); |
3706 | 3771 | return val(); |
3707 | 3772 | } |
3708 | 3773 | template <class U = T, |
3709 | 3774 | detail::enable_if_t<!std::is_void<U>::value> * = nullptr> |
3710 | 3775 | TL_EXPECTED_11_CONSTEXPR U &operator*() & { |
| 3776 | + TL_ASSERT(has_value()); |
3711 | 3777 | return val(); |
3712 | 3778 | } |
3713 | 3779 | template <class U = T, |
3714 | 3780 | detail::enable_if_t<!std::is_void<U>::value> * = nullptr> |
3715 | 3781 | constexpr const U &&operator*() const && { |
| 3782 | + TL_ASSERT(has_value()); |
3716 | 3783 | return std::move(val()); |
3717 | 3784 | } |
3718 | 3785 | template <class U = T, |
3719 | 3786 | detail::enable_if_t<!std::is_void<U>::value> * = nullptr> |
3720 | 3787 | TL_EXPECTED_11_CONSTEXPR U &&operator*() && { |
| 3788 | + TL_ASSERT(has_value()); |
3721 | 3789 | return std::move(val()); |
3722 | 3790 | } |
3723 | 3791 |
|
@@ -3753,10 +3821,22 @@ class expected : private detail::expected_move_assign_base<T, E>, |
3753 | 3821 | return std::move(val()); |
3754 | 3822 | } |
3755 | 3823 |
|
3756 | | - constexpr const E &error() const & { return err().value(); } |
3757 | | - TL_EXPECTED_11_CONSTEXPR E &error() & { return err().value(); } |
3758 | | - constexpr const E &&error() const && { return std::move(err().value()); } |
3759 | | - TL_EXPECTED_11_CONSTEXPR E &&error() && { return std::move(err().value()); } |
| 3824 | + constexpr const E &error() const & { |
| 3825 | + TL_ASSERT(!has_value()); |
| 3826 | + return err().value(); |
| 3827 | + } |
| 3828 | + TL_EXPECTED_11_CONSTEXPR E &error() & { |
| 3829 | + TL_ASSERT(!has_value()); |
| 3830 | + return err().value(); |
| 3831 | + } |
| 3832 | + constexpr const E &&error() const && { |
| 3833 | + TL_ASSERT(!has_value()); |
| 3834 | + return std::move(err().value()); |
| 3835 | + } |
| 3836 | + TL_EXPECTED_11_CONSTEXPR E &&error() && { |
| 3837 | + TL_ASSERT(!has_value()); |
| 3838 | + return std::move(err().value()); |
| 3839 | + } |
3760 | 3840 |
|
3761 | 3841 | template <class U> |
3762 | 3842 | constexpr T value_or(U &&v) const & { |
@@ -6609,6 +6689,7 @@ struct url_search_params { |
6609 | 6689 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-has |
6610 | 6690 | */ |
6611 | 6691 | inline bool has(std::string_view key) noexcept; |
| 6692 | + inline bool has(std::string_view key, std::string_view value) noexcept; |
6612 | 6693 |
|
6613 | 6694 | /** |
6614 | 6695 | * @see https://url.spec.whatwg.org/#dom-urlsearchparams-set |
@@ -6733,6 +6814,15 @@ inline bool url_search_params::has(const std::string_view key) noexcept { |
6733 | 6814 | return entry != params.end(); |
6734 | 6815 | } |
6735 | 6816 |
|
| 6817 | +inline bool url_search_params::has(std::string_view key, |
| 6818 | + std::string_view value) noexcept { |
| 6819 | + auto entry = |
| 6820 | + std::find_if(params.begin(), params.end(), [&key, &value](auto ¶m) { |
| 6821 | + return param.first == key && param.second == value; |
| 6822 | + }); |
| 6823 | + return entry != params.end(); |
| 6824 | +} |
| 6825 | + |
6736 | 6826 | inline std::string url_search_params::to_string() { |
6737 | 6827 | auto character_set = ada::character_sets::WWW_FORM_URLENCODED_PERCENT_ENCODE; |
6738 | 6828 | std::string out{}; |
@@ -6807,14 +6897,14 @@ inline void url_search_params::sort() { |
6807 | 6897 | #ifndef ADA_ADA_VERSION_H |
6808 | 6898 | #define ADA_ADA_VERSION_H |
6809 | 6899 |
|
6810 | | -#define ADA_VERSION "2.6.0" |
| 6900 | +#define ADA_VERSION "2.6.1" |
6811 | 6901 |
|
6812 | 6902 | namespace ada { |
6813 | 6903 |
|
6814 | 6904 | enum { |
6815 | 6905 | ADA_VERSION_MAJOR = 2, |
6816 | 6906 | ADA_VERSION_MINOR = 6, |
6817 | | - ADA_VERSION_REVISION = 0, |
| 6907 | + ADA_VERSION_REVISION = 1, |
6818 | 6908 | }; |
6819 | 6909 |
|
6820 | 6910 | } // namespace ada |
|
0 commit comments