Skip to content

dtl::XX::YY::getValue

Kasugaccho edited this page Aug 13, 2019 · 1 revision

Select Language ๐ŸŒ

English ๐Ÿ‡ฌ๐Ÿ‡ง / ๆ—ฅๆœฌ่ชž ๐Ÿ‡ฏ๐Ÿ‡ต


[[nodiscard]] constexpr T getValue() const noexcept;

Overview

Gets the drawing value.

Return Value

The return type is T.

Exception

Don't throw exception.

Computational Complexity

Constant time.

Example

#include <DTL.hpp>
#include <iostream>
#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]{};

	dtl::shape::Border<shape_t> border;

	border.setValue(2).drawArray(matrix, width, height);

	std::cout << "Value:" << static_cast<int>(border.getValue()) << '\n';

	dtl::console::OutputNumber<shape_t>(",").drawArray(matrix, width, height);
	dtl::console::OutputString<shape_t>("//", "##", "%%").drawArray(matrix, width, height);

	return 0;
}

Output

Value:2
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%////////////////////////////%%
%%////////////////////////////%%
%%////////////////////////////%%
%%////////////////////////////%%
%%////////////////////////////%%
%%////////////////////////////%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Clone this wiki locally