GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::array::fill(3) C++ Standard Libary std::array::fill(3)

std::array::fill - std::array::fill


void fill( const T& value ); (since C++11)
(until C++20)
constexpr void fill( const T& value ); (since C++20)


Assigns the given value value to all elements in the container.


value - the value to assign to the elements


(none)


Linear in the size of the container.

// Run this code


#include <array>
#include <cstddef>
#include <iostream>


int main()
{
constexpr std::size_t xy = 4;


using Cell = std::array<unsigned char, 8>;


std::array<Cell, xy * xy> board;


board.fill({ {0xE2, 0x96, 0x84, 0xE2, 0x96, 0x80, 0, 0} }); // "▄▀";


for (std::size_t count{}; Cell c : board)
{
std::cout << c.data() << ((++count % xy) ? "" : "\n");
}
}


▄▀▄▀▄▀▄▀
▄▀▄▀▄▀▄▀
▄▀▄▀▄▀▄▀
▄▀▄▀▄▀▄▀


fill copy-assigns the given value to every element in a range
(function template)
fill_n copy-assigns the given value to N elements in a range
(function template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.