Skip to content

Missing forwarding for constructor args #24

@adcgx

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;
}

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