Mantid
Loading...
Searching...
No Matches
Result.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2023 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include <string>
10
11namespace Mantid {
12namespace API {
13
14template <typename T> class Result {
15public:
16 Result(T result, std::string errors = "") : m_result(std::move(result)), m_errors(std::move(errors)) {}
17
18 // accessors
19 inline const T &result() const { return m_result; }
20 inline const std::string &errors() const { return m_errors; }
21
22 // boolean conversion so you can use it directly in an if
23 operator bool() const { return m_errors.empty(); }
24
25private:
27 std::string m_errors;
28};
29} // namespace API
30} // namespace Mantid
const std::string & errors() const
Definition Result.h:20
Result(T result, std::string errors="")
Definition Result.h:16
std::string m_errors
Definition Result.h:27
const T & result() const
Definition Result.h:19
Helper class which provides the Collimation Length for SANS instruments.
STL namespace.