mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 12:27:14 +02:00
Parallel returns Result
This commit is contained in:
@ -31,12 +31,13 @@ template <class T, class Allocator = std::allocator<T>> class Result {
|
||||
Result() = default;
|
||||
Result(std::initializer_list<T> list) : vec(list){};
|
||||
|
||||
|
||||
/** Custom constructor from integer type to Result<ns> or Result<bool> */
|
||||
template <typename V, typename = typename std::enable_if<
|
||||
std::is_integral<V>::value &&
|
||||
(std::is_same<T, time::ns>::value ||
|
||||
std::is_same<T, bool>::value)>::type>
|
||||
Result(const std::vector<V> &from) {
|
||||
Result(const Result<V> &from) {
|
||||
vec.reserve(from.size());
|
||||
for (const auto &item : from)
|
||||
vec.push_back(T(item));
|
||||
@ -47,7 +48,7 @@ template <class T, class Allocator = std::allocator<T>> class Result {
|
||||
std::is_integral<V>::value &&
|
||||
(std::is_same<T, time::ns>::value ||
|
||||
std::is_same<T, bool>::value)>::type>
|
||||
Result(std::vector<V> &from) {
|
||||
Result(Result<V> &from) {
|
||||
vec.reserve(from.size());
|
||||
for (const auto &item : from)
|
||||
vec.push_back(T(item));
|
||||
@ -58,7 +59,7 @@ template <class T, class Allocator = std::allocator<T>> class Result {
|
||||
std::is_integral<V>::value &&
|
||||
(std::is_same<T, time::ns>::value ||
|
||||
std::is_same<T, bool>::value)>::type>
|
||||
Result(std::vector<V> &&from) {
|
||||
Result(Result<V> &&from) {
|
||||
vec.reserve(from.size());
|
||||
for (const auto &item : from)
|
||||
vec.push_back(T(item));
|
||||
@ -90,6 +91,7 @@ template <class T, class Allocator = std::allocator<T>> class Result {
|
||||
auto empty() const noexcept -> decltype(vec.empty()) { return vec.empty(); }
|
||||
auto front() -> decltype(vec.front()) { return vec.front(); }
|
||||
auto front() const -> decltype(vec.front()) { return vec.front(); }
|
||||
void reserve(size_type new_cap) { vec.reserve(new_cap); }
|
||||
|
||||
template <typename V>
|
||||
auto push_back(V value) -> decltype(vec.push_back(value)) {
|
||||
|
Reference in New Issue
Block a user