Skip to content

Enable forward semantic for emplace_back #20

@VasilyMarkov

Description

@VasilyMarkov

Hi!
Looks like in this emplace_back, forward will not work because there is no type deduction here.The value_type&& here is just a rvalue reference.

constexpr void emplace_back(value_type&& value) { v_.emplace_back(forward<value_type>(value)); }

You need to add a template parameter, something like this:

template<typename T = value_type>
constexpr void emplace_back(T&& value) { v_.emplace_back(forward<T>(value)); } 

https://en.cppreference.com/w/cpp/container/vector/emplace_back.html

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