Skip to content

value_ptr and abstract types as an element_type #8

Description

@flexferrum

Not sure about direct PR. Decided to make issue for discussion. Looks like current implementation doesn't allow to hold abstract types in value_ptr. Cloner and Deleters implies that it should be possible but value_or method breaks this possibility:

    element_type value_or( U && v ) const
    {
        return has_value() ? value() : static_cast<element_type>(std::forward<U>( v ) );
    }

It implies that element_type should be able to construct from arbitrary type. For abstract types that's wrong expectation. What if "hide" value_or method under enable_if?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions