Home >Web Front-end >Front-end Q&A >Does JavaScript have stl library?

Does JavaScript have stl library?

WBOY
WBOYOriginal
2022-04-11 11:01:002201browse

JavaScript does not have stl library. The stl library is the standard template library. It is an efficient "C" program library with industrial strength. It is used to provide basic extended support for the data structure of the language itself. The stl library is accommodated in the "C" standard program library, so in There is no stl library in JavaScript.

Does JavaScript have stl library?

The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.

Does JavaScript have an stl library?

JavaScript does not have an stl library

STL = Standard Template Library, the general name for a series of software developed by HP Labs.

C's STL is positioned to provide basic data structures of the language itself and other extended support

STL (Standard Template Library), that is, the standard template library, is an industrial-strength, Efficient C library. It is included in the C Standard Library and is the latest and most revolutionary part of the ANSI/ISO C standard. This library contains many basic data structures and basic algorithms commonly used in computer science. It provides an extensible application framework for C programmers, which highly reflects the reusability of software.

stl library content example:

vector vector (variable length array)

1. Header file

#include<vector> // 头文件

2. Common commands

vector<int>vec; // 申请一个vector容器,这里int也可以是其他数据类型
vec.push_back(num); // 向容器最后插入一个数
numvec.size();// 查询目前容器的大小,常用于遍历

3. Two-dimensional array

We can also apply for multiple vectors at one time, so that they can function as two-dimensional arrays.

vector<int>vec[100]; // 申请100个不定长容器

map associative container

Some of the previous content is also compiled from other blogs Detailed explanation of map usage in STL in C

1. Header file

#include<map> // 头文件

2. Commonly used commands

Here is an example of a homework question, Luogu Hash template question P3370 [Template] String Hash

map<string,bool>mp; // 申请一个map,这个意思是申请一个名叫mp的map它可以将一个string类型的映射成bool类型。当然名字和类型都是可以换的
mp["abc"] = 1; // 之后输出mp["abc"]就会是1要是没有上一步输出就会是0
mp.size(); // 容器的大小

[Related recommendations:javascript video tutorialweb front-end

The above is the detailed content of Does JavaScript have stl library?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn