#include "agent_based_epidemic_sim/util/records.h"

namespace abesim {

constexpr int kReadFlag = O_RDONLY;
constexpr int kWriteFlag = O_CREAT | O_WRONLY;

riegeli::RecordReader<RiegeliBytesSource> MakeRecordReader(
    absl::string_view filename) {
  return riegeli::RecordReader<RiegeliBytesSource>(
      std::forward_as_tuple(filename, kReadFlag));
}
riegeli::RecordWriter<RiegeliBytesSink> MakeRecordWriter(
    absl::string_view filename, const int parallelism) {
  return riegeli::RecordWriter<RiegeliBytesSink>(
      std::forward_as_tuple(filename, kWriteFlag),
      riegeli::RecordWriterBase::Options().set_parallelism(parallelism));
}

}  // namespace abesim

#include "agent_based_epidemic_sim/util/records.h"

namespace abesim {

constexpr int kReadFlag = O_RDONLY;
constexpr int kWriteFlag = O_CREAT | O_WRONLY;

riegeli::RecordReader<RiegeliBytesSource> MakeRecordReader(
    absl::string_view filename) {
  return riegeli::RecordReader(RiegeliBytesSource(filename, kReadFlag));
}
riegeli::RecordWriter<RiegeliBytesSink> MakeRecordWriter(
    absl::string_view filename, const int parallelism) {
  return riegeli::RecordWriter(
      RiegeliBytesSink(filename, kWriteFlag),
      riegeli::RecordWriterBase::Options().set_parallelism(parallelism));
}

}  // namespace abesim

Improve readability of constructor calls of Riegeli classes.
Improve readability of constructor calls of Riegeli classes.

Write the type name instead of `std::forward_as_tuple` for construction of
dependencies of these classes. This looks better, at the cost of a tiny
performance hit: the dependency is constructed as a temporary and then moved,
instead of being constructed in place.

Rely on CTAD
(https://en.cppreference.com/w/cpp/language/class_template_argument_deduction)
for Riegeli classes to avoid writing the class template argument, in cases the
template argument reflects the type of the first constructor argument. Riegeli
classes provide deduction guides to make it clear that this is supported.

CTAD requires C++17.

PiperOrigin-RevId: 364632707
