row_view.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // Copyright (c) 2019-2023 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. #ifndef BOOST_MYSQL_IMPL_ROW_VIEW_HPP
  8. #define BOOST_MYSQL_IMPL_ROW_VIEW_HPP
  9. #pragma once
  10. #include <boost/mysql/row_view.hpp>
  11. #include <boost/mysql/detail/auxiliar/access_fwd.hpp>
  12. #include <cstddef>
  13. #include <ostream>
  14. #include <stdexcept>
  15. boost::mysql::field_view boost::mysql::row_view::at(std::size_t i) const
  16. {
  17. if (i >= size_)
  18. throw std::out_of_range("row_view::at");
  19. return fields_[i];
  20. }
  21. inline bool boost::mysql::operator==(const row_view& lhs, const row_view& rhs) noexcept
  22. {
  23. if (lhs.size() != rhs.size())
  24. return false;
  25. for (std::size_t i = 0; i < lhs.size(); ++i)
  26. {
  27. if (lhs[i] != rhs[i])
  28. return false;
  29. }
  30. return true;
  31. }
  32. struct boost::mysql::detail::row_view_access
  33. {
  34. static row_view construct(const field_view* f, std::size_t size) noexcept { return row_view(f, size); }
  35. };
  36. #endif