Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to the usage of Array and vector in Category 11

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "introduction to the usage of Array and vector in Craft 11". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next, let's let the editor take you to learn the usage of Array and vector in Category 11.

Array

-for Array, it is a fixed-size sequence container that contains a specific number of elements sorted in a strict linear sequence. Internally, the array does not retain any data except the elements it contains (not even its size (this is a template parameter, fixed at compile time). In terms of storage size, it is as effective as a normal array declared using the language's parenthesis syntax ([]). This class adds only one layer member and global function to it, so you can use the array as a standard container. It is important to know that zero-size arrays are valid, but should not be dereferenced

The template form of 1.Array is template

< class T, size_t N >

Class array

The function of 2.Array

Array::begin- returns the start of the iterator

Array::end- returns the end of the iterator

Array::rbegin- returns the reverse iterator to start in reverse

Array::rend- returns the reverse iterator at the end of the direction

The const type pointed to by the array::cbegin- pointer, which cannot be modified

Array::cend- is the same.

Array::data ()-there are two forms, one is const, the other is non-const, which returns the contents of the array

/ / array::data # include # include # include int main () {const char* cstr = "www.linuxmi.com"; std::array charray; std::memcpy (charray.data (), cstr,15); std::cout

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report