Skip to content

Missing forwarding for constructor args #24

Description

@adcgx

In areas like:

template <class NodeType, typename... Args>
SomeBuilder<Parent> leaf(Args... args)
{
    auto child = std::make_shared<NodeType>((args)...);
    node->setChild(child);
    return *this;
}

there needs to be forwarding to avoid unintended copying:

template <class NodeType, typename... Args>
SomeBuilder<Parent> leaf(Args&&... args)
{
    auto child = std::make_shared<NodeType>(std::forward<Args>(args)...);
    node->setChild(child);
    return *this;
}

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions