Skip to content

Commit f24964f

Browse files
committed
AI code review
1 parent dcf6361 commit f24964f

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

include/openPMD/IO/InvalidatableFile.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ struct less<openPMD::InvalidatableFile>
9393
{
9494
using first_argument_type = openPMD::InvalidatableFile;
9595
using second_argument_type = first_argument_type;
96-
using result_type = typename std::less<std::string>::result_type;
96+
using result_type = decltype(std::less<>()(
97+
*std::declval<first_argument_type const &>(),
98+
*std::declval<second_argument_type const &>()));
9799
result_type
98100
operator()(first_argument_type const &, second_argument_type const &) const;
99101
};

include/openPMD/auxiliary/Future.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <functional>
4+
#include <type_traits>
45
#include <variant>
56

67
namespace openPMD::auxiliary::detail
@@ -69,6 +70,15 @@ class DeferredComputation
6970
*/
7071
DeferredComputation(cached_type val);
7172

73+
explicit DeferredComputation();
74+
75+
DeferredComputation(DeferredComputation &&) noexcept;
76+
DeferredComputation(DeferredComputation const &) = delete;
77+
78+
auto operator=(DeferredComputation &&) noexcept -> DeferredComputation &;
79+
auto operator=(DeferredComputation const &)
80+
-> DeferredComputation & = delete;
81+
7282
~DeferredComputation();
7383

7484
/** Get the result of the computation

src/IO/AbstractIOHandler.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ std::future<void> AbstractIOHandler::flush(internal::ParsedFlushParams &params)
131131
// been flushed already.
132132
bool increase_flush_counter = !m_work.empty();
133133
auto res = this->flush_impl(params);
134-
if (increase_flush_counter && m_work.empty())
134+
if (!m_work.empty())
135+
{
136+
throw error::Internal("flush() did not clear all work!");
137+
}
138+
if (increase_flush_counter)
135139
{
136140
++*m_flushCounter;
137141
}

src/auxiliary/Future.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ DeferredComputation<T>::DeferredComputation(cached_type cached_val)
5353
: m_task(detail::CachedValue<T>{std::move(cached_val)})
5454
{}
5555

56+
template <typename T>
57+
DeferredComputation<T>::DeferredComputation() = default;
58+
59+
template <typename T>
60+
DeferredComputation<T>::DeferredComputation(DeferredComputation &&) noexcept =
61+
default;
62+
63+
template <typename T>
64+
auto DeferredComputation<T>::operator=(DeferredComputation &&) noexcept
65+
-> DeferredComputation & = default;
66+
5667
template <typename T>
5768
DeferredComputation<T>::~DeferredComputation()
5869
{

0 commit comments

Comments
 (0)