I noticed it was not possible to pass data to `Graph::addComponent`
using a temporary object:
graph->addComponent(*srcCompCls, "source-1", TestSourceData {});
My understanding of it is that the compiler does not consider the
overload with the `InitDataT&` parameter for this, because the temporary
object can't bind to the lvalue reference.
Change these methods to take forwarding references instead.
Change-Id: Icc80239812c325b777ed83e8634302a0c9d72f14
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12049
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
template <typename InitDataT>
ConstSourceComponent addComponent(const ConstSourceComponentClass componentClass,
template <typename InitDataT>
ConstSourceComponent addComponent(const ConstSourceComponentClass componentClass,
- const bt2c::CStringView name, InitDataT& initData,
+ const bt2c::CStringView name, InitDataT&& initData,
const OptionalBorrowedObject<ConstMapValue> params = {},
const LoggingLevel loggingLevel = LoggingLevel::NONE) const
{
const OptionalBorrowedObject<ConstMapValue> params = {},
const LoggingLevel loggingLevel = LoggingLevel::NONE) const
{
template <typename InitDataT>
ConstFilterComponent addComponent(const ConstFilterComponentClass componentClass,
template <typename InitDataT>
ConstFilterComponent addComponent(const ConstFilterComponentClass componentClass,
- const bt2c::CStringView name, InitDataT& initData,
+ const bt2c::CStringView name, InitDataT&& initData,
const OptionalBorrowedObject<ConstMapValue> params = {},
const LoggingLevel loggingLevel = LoggingLevel::NONE) const
{
const OptionalBorrowedObject<ConstMapValue> params = {},
const LoggingLevel loggingLevel = LoggingLevel::NONE) const
{
template <typename InitDataT>
ConstSinkComponent addComponent(const ConstSinkComponentClass componentClass,
template <typename InitDataT>
ConstSinkComponent addComponent(const ConstSinkComponentClass componentClass,
- const bt2c::CStringView name, InitDataT& initData,
+ const bt2c::CStringView name, InitDataT&& initData,
const OptionalBorrowedObject<ConstMapValue> params = {},
const LoggingLevel loggingLevel = LoggingLevel::NONE) const
{
const OptionalBorrowedObject<ConstMapValue> params = {},
const LoggingLevel loggingLevel = LoggingLevel::NONE) const
{