@@ -472,13 +472,15 @@ template <typename F>
472
472
class ExpectationFunc : public Expectation <decltype (std::declval<F>()())> {
473
473
static_assert (Util::is_functional<F>::value,
474
474
" Error! ExpectationFunc can only contaion lambdas." );
475
+
476
+ typedef decltype (std::declval<F>()()) block_ret_t;
475
477
F block;
476
- std::shared_ptr<decltype (std::declval<F>()()) > computed = nullptr ;
478
+ std::shared_ptr<block_ret_t > computed = nullptr ;
477
479
478
480
public:
479
481
ExpectationFunc (ExpectationFunc<F> const ©)
480
- : Expectation<decltype (std::declval<F>()()) >(copy), block(copy.block) {}
481
-
482
+ : Expectation<block_ret_t >(copy), block(copy.block) {}
483
+
482
484
/* *
483
485
* @brief Create an ExpectationValue using a value.
484
486
*
@@ -487,8 +489,8 @@ class ExpectationFunc : public Expectation<decltype(std::declval<F>()())> {
487
489
* @return The constructed ExpectationValue.
488
490
*/
489
491
ExpectationFunc (ItBase &it, F block)
490
- : Expectation<decltype (block()) >(it), block(block) {}
491
-
492
+ : Expectation<block_ret_t >(it), block(block) {}
493
+
492
494
/* *
493
495
* @brief Create an Expectation using a function.
494
496
*
@@ -507,9 +509,9 @@ class ExpectationFunc : public Expectation<decltype(std::declval<F>()())> {
507
509
// {}
508
510
509
511
/* * @brief Get the target of the expectation. */
510
- decltype (block()) &get_target () & override {
511
- if (! computed) {
512
- computed = std::make_shared<decltype ( block ()) >(block ());
512
+ block_ret_t &get_target () & override {
513
+ if (computed == nullptr ) {
514
+ computed = std::make_shared<block_ret_t >(block ());
513
515
}
514
516
return *computed;
515
517
}
0 commit comments