Almost finalize main api of cetl::any - now close to std::any features. - #104
Conversation
…tures. - Added "value return" overloads of any_cast (#1️⃣, 2️⃣ & 3️⃣). - Added std::initializer_list overloads for - ctor (#6️⃣) - `emplace` (#2️⃣) - `make_any` (#2️⃣) - Added corresponding unit tests, plus more cases to increase coverage.
pavel-kirienko
left a comment
There was a problem hiding this comment.
soo_handler::create needs this
assert(nullptr == dest.handler_);before assigning dest.handler_ = handle;
| /// | ||
| /// Equivalent to `cetl::any(cetl::in_place_type<ValueType>, list, std::forward<Args>(args)...)`. | ||
| /// | ||
| template <typename ValueType, typename Any, typename Up, typename... Args> |
There was a problem hiding this comment.
I wonder if we could default Any to something like this:
| template <typename ValueType, typename Any, typename Up, typename... Args> | |
| template <T> | |
| using any_like = any<sizeof(T), | |
| std::is_copy_constructible<T>::value, | |
| std::is_move_constructible<T>::value, | |
| std::max(alignof(T), alignof(std::max_align_t))>; | |
| template <typename ValueType, typename Any = any_like<ValueType>, typename Up, typename... Args> |
I only thought about this now but it should have been during the previous review.
Do you think it makes sense? Otherwise we deviate from the semantics of std::make_any quite a bit as it doesn't require one to specify the type of any.
There was a problem hiding this comment.
Yes, it does. I even thought about it but didn't come up with your quite simple solution. Let me please add this topic to my "todo list" for some next PR. Thanks!
pavel-kirienko
left a comment
There was a problem hiding this comment.
assert is still missing, please see the previous review comment
|



emplace(#2️⃣)make_any(#2️⃣)Notes for to be continued...
Alignparam fixes will be in the next pr.const_cast) will be in the after next pr.