Skip to content

dtl::XX::YY::createArray

Kasugaccho edited this page Aug 13, 2019 · 1 revision

Select Language 🌐

English 🇬🇧 / 日本語 🇯🇵


// Array
template<typename Matrix_>
auto createArray(Matrix_&& matrix_, const std::size_t max_x_, const std::size_t max_y_) const noexcept;

Overview

Draw on Matrix.

Return Value

The return type is Matrix type of argument.

Exception

Don't throw exception.

Computational Complexity

O(n^2).

  • Some are O(n).

Example

#include <DTL.hpp>
#include <cstddef>
#include <cstdint>

int main() {

	using shape_t = std::uint_fast8_t;
	constexpr std::size_t width{ 16 };
	constexpr std::size_t height{ 8 };

	shape_t matrix[height * width]{};

	auto&& catch_matrix{ dtl::shape::Border<shape_t>(1).createArray(matrix, width, height) };

	dtl::console::OutputString<shape_t>("//", "##").createArray(catch_matrix, width, height);

	return 0;
}

Output

################################
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
################################

Clone this wiki locally