本文整理汇总了C++中Aggregate::get_t方法的典型用法代码示例。如果您正苦于以下问题:C++ Aggregate::get_t方法的具体用法?C++ Aggregate::get_t怎么用?C++ Aggregate::get_t使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aggregate
的用法示例。
在下文中一共展示了Aggregate::get_t方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Aggregate
template <typename TArgs, typename UArgs>
Aggregate(TArgs t_args, UArgs u_args)
: t{std::move(t_args).construct()}, u{std::move(u_args).construct()}
{}
T const &get_t() const { return t; }
U const &get_u() const { return u; }
private:
T t;
U u;
};
}
SCENARIO("basic aggregate") {
GIVEN("an aggregate type constructed with rvalue tuples") {
Aggregate<A, B> aggregate{
mp::builder(mp::construct<A>, "foo", 33)
, mp::builder(mp::braced_construct<B>, 42, "bar", 77)
};
THEN("piecewise construction works") {
REQUIRE(aggregate.get_t().get_thirty_three() == 33);
REQUIRE(aggregate.get_t().get_foo() == "foo");
REQUIRE(aggregate.get_u().forty_two == 42);
REQUIRE(aggregate.get_u().bar == "bar");
REQUIRE(aggregate.get_u().seventy_seven == 77);
}
}
}