1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi"). 16 template<
class Item >
23 template<
class Result,
class Self >
24 static auto checked_at( Self&
self,
const Index col,
const Index row )
32 "Item position ("s << col <<
"," << row <<
") is out of range" 34 return self.m_items[
self.index_of( col, row )];
42 auto begin()
const {
return m_items.begin(); }
43 auto end()
const {
return m_items.end(); }
44 auto data()
const {
return m_items.data(); }
45 auto begin() {
return m_items.begin(); }
46 auto end() {
return m_items.end(); }
47 auto data() {
return m_items.data(); }
51 {
return row*m_width + col; }
55 {
return i % m_width; }
59 {
return i / m_width; }
63 {
return m_items[
index_of( col, row )]; }
67 {
return m_items[
index_of( col, row )]; }
71 {
return checked_at<const Item>( *
this, col, row ); }
75 {
return checked_at<Item>( *
this, col, row ); }
auto col_of(const Index i) const -> Index
auto at(const Index col, const Index row) const -> const Item &
auto height() const -> Size
auto hopefully(const Truth condition) -> Truth
auto is_in(const basic_string_view< Char > &sv, const Char ch) noexcept -> Truth
auto operator()(const Index col, const Index row) -> Item &
auto row_of(const Index i) const -> Index
CPPX_USE_STD(basic_string, basic_string_view, bitset, char_traits, size)
auto at(const Index col, const Index row) -> Item &
Size Index
Same as Size but with name signifying use as index.
constexpr auto up_to(const Integer n) noexcept -> Range_< Integer >
auto index_of(const Index col, const Index row) const -> Index
Signed_< size_t > Size
A Signed_ equivalent of size_t.
auto width() const -> Size
auto n_items() const -> Size
Macros for generating more concise and clear using statements, primarily $use_cppx and $use_std,...
Matrix_(const Size width, const Size height)
Signed Size and Index, plus unsigned equivalents Unsigned_size and Unsigned_index.
auto operator()(const Index col, const Index row) const -> const Item &
#define CPPX_FAIL_(X,...)