Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cetl::pf20::span should accept pointers as its template T type. #115

Closed
serges147 opened this issue Apr 10, 2024 · 0 comments · Fixed by #117
Closed

cetl::pf20::span should accept pointers as its template T type. #115

serges147 opened this issue Apr 10, 2024 · 0 comments · Fixed by #117
Assignees

Comments

@serges147
Copy link
Contributor

At libcyphal currently there is such todo:

    CETL_NODISCARD static inline Expected<UniquePtr<IUdpTransport>, FactoryError> make(
        cetl::pmr::memory_resource&  memory,
        IMultiplexer&                mux,
        const std::array<IMedia*, 3> media,  // TODO: replace with `cetl::span<IMedia*>`
        const cetl::optional<NodeId> local_node_id);

Making it as below works only on c++ 20 (where there is no our span polyfil):

    ...
        const cetl::span<IMedia*>    media,
    ...

, but it fails on c++14 & 17 with following compiler error:

In file included from /Users/sergei/Develop/git/OpenCyphal-Garage/libcyphal/external/cetl/include/cetl/pf20/cetlpf.hpp:63:
/Users/sergei/Develop/git/OpenCyphal-Garage/libcyphal/external/cetl/include/cetl/pf20/span.hpp:492:5: error: static assertion failed due to requirement '!std::is_pointer<libcyphal::transport::can::IMedia *>::value': Can not be a pointer type
    static_assert(not std::is_pointer<T>::value, "Can not be a pointer type");
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sergei/Develop/git/OpenCyphal-Garage/libcyphal/include/libcyphal/transport/can/transport.hpp:97:34: note: in instantiation of template class 'cetl::pf20::span<libcyphal::transport::can::IMedia *>' requested here
    const cetl::span<IMedia*>    media,  // TODO: replace with `cetl::span<IMedia*>`
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants