This is a ‘type interface.’ See Type Interfaces for more info on what that is.
This abstract type interface describes a type which results in some output. This might be for example some forms of MHRWStatsCollector Interface 's such as Tomographer::ValueHistogramMHRWStatsCollector which results in a histogram.
- Since
- Added in Tomographer 5.0: added the stealResult() member
- typedef .. ResultType
- The type that the result has. It should be default-constructible, copyable, and assignable.
- ResultType getResult()
- Obtain the said result. The return type must be anything that may be assigned to a ResultType type, or a value that the ResultType accepts in a constructor.
- ResultType stealResult()
- Retrieve the said result, with the caller guaranteeing that it will never ask for the result again, i.e. that getResult() or stealResult() will never be called again on this instance. This allows the Resultable type to avoid copying the result and instead std::move() it to the return type.
- Note that to successfully move the result type to the return type of the stealResult() function, the ResultType must have a move constructor, stealResult() must not be declared const and must have as result type ResultType (without any references).
- Of course, you may just choose to copy the result again (i.e. have stealResult() be declared in the same way and with same functionality as getResult()) if you don't want to write a different stealResult() implementation or if the result type is cheap to copy.