MRPT  2.0.4
matrix_size_t.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <array>
12 
13 namespace mrpt::math
14 {
15 /** Auxiliary class used in CMatrixDynamic:size(), CMatrixDynamic::resize(),
16  * CMatrixFixed::size(), CMatrixFixed::resize(), to mimic the
17  * behavior of STL-containers.
18  * \ingroup mrpt_math_grp
19  */
20 struct matrix_size_t : public std::array<std::size_t, 2>
21 {
22  constexpr matrix_size_t() : std::array<std::size_t, 2>{0, 0} {}
23  constexpr matrix_size_t(const std::size_t rows, const std::size_t cols)
24  : std::array<std::size_t, 2>{rows, cols}
25  {
26  }
27 
28  /** Cast to size_t as the overall number of matrix/vector elements */
29  operator std::size_t() const { return at(0) * at(1); }
30 };
31 
32 } // namespace mrpt::math
constexpr matrix_size_t(const std::size_t rows, const std::size_t cols)
Definition: matrix_size_t.h:23
STL namespace.
This base provides a set of functions for maths stuff.
Auxiliary class used in CMatrixDynamic:size(), CMatrixDynamic::resize(), CMatrixFixed::size(), CMatrixFixed::resize(), to mimic the behavior of STL-containers.
Definition: matrix_size_t.h:20



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020