C++中的STL——list类的基本使用

news2025/5/24 10:39:10

目录

list类介绍

list类定义

list类常见构造

list类的有效元素个数操作

size()函数

list遍历操作

list元素修改操作

assign()函数

push_front()函数

push_back()函数

pop_front()函数

pop_back()函数

insert()函数

erase()函数

swap()函数

resize()函数

clear()函数

list类数据操作

splice()函数

sort()函数

unique()函数

merge()函数

reverse()函数


list类介绍

  1. list是可以在常数范围内在任意位置进行插入和删除的序列式容器,并且该容器可以前后双向迭代。
  2. list的底层是双向链表结构,双向链表中每个元素存储在互不相关的独立节点中,在节点中通过指针指向其前一个元素和后一个元素。
  3. list与forward_list非常相似:最主要的不同在于forward_list是单链表,只能朝前迭代,已让其更简单高效。
  4. 与其他的序列式容器相比(array,vector,deque),list通常在任意位置进行插入、移除元素的执行效率更好。
  5. 与其他序列式容器相比,list和forward_list最大的缺陷是不支持任意位置的随机访问,比如:要访问list的第6个元素,必须从已知的位置(比如头部或者尾部)迭代到该位置,在这段位置上迭代需要线性的时间开销;list还需要一些额外的空间,以保存每个节点的相关联信息(对于存储类型较小元素的大list来说这可能是一个重要的因素)

list类定义

template < class T, class Alloc = allocator<T> > class list;

list类为类模板,所以在使用时需要带上类型表示一个具体的类,例如数据类型为int类型的list使用时需要写为list<int>

list类常见构造

构造函数

函数原型

无参构造函数

explicit list ();

指定个数个类型值进行构造

explicit list (size_type n, const value_type& val = value_type())

使用类对象迭代器区间进行构造

template <class InputIterator>

list (InputIterator first, InputIterator last);

拷贝构造函数

list (const list& x);

📌

上面表格中的前三个构造函数均含有自定义空间配置器并带有缺省值,目前只使用默认的空间配置器即可

📌

使用list类需要包含头文件<list>

#include <iostream>
#include <list>
using namespace std;

int main()
{
    //无参构造函数
    list<int> ls;
    cout << ls.size() << endl;

    return 0;
}
输出结果:
0

对于list类来说,因为是带头双向循环链表,所以不存在容量capacity,但是默认会有一个头节点,因为没有有效数据节点,所以当前头节点的头尾指针均指向自己

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls(10, 5);

    cout << ls.size() << endl;
    for (auto num : ls)
    {
        cout << num << " ";
    }

    return 0;
}
输出结果:
10
5 5 5 5 5 5 5 5 5 5

//使用类对象迭代器区间进行构造
#include <iostream>
#include <list>
#include <vector>
using namespace std;

int main()
{
    list<int> ls(5, 10);
    list<int> ls1(ls.begin(), ls.end());

    for (auto num : ls)
    {
        cout << num << " ";
    }

    cout << endl;

    for (auto num : ls1)
    {
        cout << num << " ";
    }
    cout << endl;

    //也可使用其他类对象迭代器区间进行构造
    vector<int> v(5, 10);
    list<int> ls2(v.begin(), v.end());
    for (auto num : ls2)
    {
        cout << num << " ";
    }

    return 0;
}
输出结果:
10 10 10 10 10
10 10 10 10 10
10 10 10 10 10

//拷贝构造函数
#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls(5, 10);
    list<int> ls1(ls);

    for (auto num : ls)
    {
        cout << num << " ";
    }

    cout << endl;

    for (auto num : ls1)
    {
        cout << num << " ";
    }
    
    return 0;
}
输出结果:
10 10 10 10 10
10 10 10 10 10

list类的有效元素个数操作

函数

功能

size()

获取当前链表中的有效数据个数

max_size()

获取调用对象空间可以存储的有效数据最大个数

size()函数

使用size()函数可以获取到当前链表中的有效元素个数

📌

前面已经演示过使用方法,此处不再演示

list遍历操作

在list中,只有迭代器遍历的方式

迭代器

功能

begin()+end()

begin获取第一个数据的迭代器 + end获取最后一个数据下一个位置的迭代器(默认包含const类型的迭代器,也可以使用cbegin()+cend()

rbegin()+rend()

rbegin获取最后一个数据的迭代器 + rend获取第一个数据上一个位置的迭代器(默认包含const类型的迭代器,也可以使用rcbegin()+rcend()

cbegin()+cend()

const类型的begin()end()的迭代器,针对const对象

crbegin()+crend()

const类型的rbegin()rend()的迭代器,针对const对象

list元素修改操作

函数

功能

assign()

为调用对象空间重新分配内容为指定内容

push_front()

在第一个节点位置前插入一个新的数据节点

push_back()

在最后一个节点位置后插入一个新的数据节点

pop_front()

删除调用对象链表中的第一个有效数据节点

pop_back()

删除调用对象链表中的最后一个有效数据节点

insert()

在调用对象链表指定位置插入一个数据节点

erase()

删除调用对象链表指定位置的数据节点

swap()

交换两个链表对象中的内容

resize()

修改调用对象链表的有效数据节点个数

clear()

清空调用对象链表的有效数据节点

assign()函数

使用assign()函数可以为调用对象链表重新分配内容,如果原始链表中有数据,那么将覆盖原始内容

函数

函数原型

assign()

template <class InputIterator>

void assign (InputIterator first, InputIterator last);

(使用指定对象的迭代器区间为调用对象重新分配内容)

void assign (size_type n, const value_type& val);

(使用nval值为调用对象重新分配内容)

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls(5, 10);
    list<int> ls1{ 1,2,3,4,5 };

    for (auto num : ls)
    {
        cout << num << " ";
    }
    ls.assign(ls1.begin(), ls1.end());
    cout << endl;
    for (auto num : ls)
    {
        cout << num << " ";
    }

    return 0;
}
输出结果:
10 10 10 10 10
1 2 3 4 5

push_front()函数

使用push_front()函数可以在调用对象的第一个有效数据节点前插入一个新的有效数据节点

📌

如果调用对象链表当前没有有效数据节点,则实现效果与push_back()类似

函数

函数原型

push_front()

void push_front (const value_type& val);

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls;
    ls.push_front(1);
    ls.push_front(2);
    ls.push_front(3);
    ls.push_front(4);

    for (auto num : ls)
    {
        cout << num << " ";
    }

    return 0;
}
输出结果:
4 3 2 1

push_back()函数

使用push_back()函数可以在调用对象的最后一个有效数据节点后插入一个新的有效数据节点

函数

函数原型

push_back()

void push_back (const value_type& val);

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls;
    ls.push_back(1);
    ls.push_back(2);
    ls.push_back(3);
    ls.push_back(4);
    ls.push_back(5);

    for (auto num : ls)
    {
        cout << num << " ";
    }
    return 0;
}
输出结果:
1 2 3 4 5

pop_front()函数

使用pop_front()函数可以删除调用对象的第一个有效数据节点

📌

如果当前链表中没有有效数据节点,则函数将会断言报错

如果当前链表中只有一个有效数据节点,则函数实现效果与pop_back()类似

函数

函数原型

pop_front()

void pop_front();

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls{ 1,2,3,4,5 };    
    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;
    ls.pop_front();
    for (auto num : ls)
    {
        cout << num << " ";
    }
    return 0;
}
输出结果:
1 2 3 4 5
2 3 4 5

pop_back()函数

使用pop_front()函数可以删除调用对象的最后一个有效数据节点

📌

如果当前链表中没有有效数据节点,则函数将会断言报错

函数

函数原型

pop_back()

void pop_back();

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls;
    ls.push_back(1);
    ls.push_back(2);
    ls.push_back(3);
    ls.push_back(4);
    ls.push_back(5);

    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;
    ls.pop_back();

    for (auto num : ls)
    {
        cout << num << " ";
    }
    return 0;
}
输出结果:
1 2 3 4 5
1 2 3 4

insert()函数

使用insert()函数可以在调用对象链表中的指定位置插入一个有效数据节点

函数

函数原型

insert()

iterator insert (iterator position, const value_type& val);

(在迭代器位置前插入数据val

void insert (iterator position, size_type n, const value_type& val);

(在迭代器位置前插入n个数据val

template <class InputIterator>

void insert (iterator position, InputIterator first, InputIterator last);

(在迭代器位置前插入指定对象迭代器区间中的数据)

📌

对于insert()函数来说,基本不存在迭代器失效问题,因为list不存在扩容问题并且空间基本不是连续的,所以position位置在插入数据后可能并没有改变

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls;
    ls.push_back(1);
    ls.push_back(2);
    ls.push_back(3);
    ls.push_back(4);
    ls.push_back(5);

    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;

    list<int>::iterator it =  find(ls.begin(), ls.end(), 2);
    ls.insert(it, 6);
    for (auto num : ls)
    {
        cout << num << " ";
    }

    return 0;
}
输出结果:
1 2 3 4 5
1 6 2 3 4 5

erase()函数

使用erase()函数可以删除调用对象链表指定位置的有效数据节点

函数

函数原型

erase()

iterator erase (iterator position);

(删除position位置的有效数据节点)

iterator erase (iterator first, iterator last);

(删除迭代器区间中的有效数据节点)

📌

对于erase()函数来说,删除当前position位置节点会导致当前position位置失效,所以存在迭代器失效问题,针对这个问题,erase()函数提供返回值返回当前被删除节点的下一个节点的位置

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls;
    ls.push_back(1);
    ls.push_back(2);
    ls.push_back(3);
    ls.push_back(4);
    ls.push_back(5);

    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;

    list<int>::iterator it =  find(ls.begin(), ls.end(), 2);
    it = ls.erase(it);
    for (auto num : ls)
    {
        cout << num << " ";
    }

    cout << endl << *it << endl;

    return 0;
}
输出结果:
1 2 3 4 5
1 3 4 5
3

swap()函数

使用swap()函数可以交换调用对象和指定对象的链表

函数

函数原型

swap()

void swap (list& x);

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls(10, 5);
    list<int> ls1(5, 10);
    cout << "交换前:" << endl;
    for (auto num : ls)
    {
        cout << num << " ";
    }    
    cout << endl;
    for (auto num : ls1)
    {
        cout << num << " ";
    }
    cout << endl;

    ls1.swap(ls);

    cout << "交换后:" << endl;
    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;
    for (auto num : ls1)
    {
        cout << num << " ";
    }

    return 0;
}
输出结果:
交换前:
5 5 5 5 5 5 5 5 5 5
10 10 10 10 10
交换后:
10 10 10 10 10
5 5 5 5 5 5 5 5 5 5

resize()函数

使用resize()函数可以修改调用对象链表中的有效数据节点的个数

函数

函数原型

resize()

void resize (size_type n, value_type val = value_type());

📌

n小于当前链表的size,则实现删除效果,否则初始化为指定类型的数据(默认为对应类型的默认值)

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls;
    ls.push_back(1);
    ls.push_back(2);
    ls.push_back(3);
    ls.push_back(4);
    ls.push_back(5);

    //只保留三个数据
    ls.resize(3);
    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;
    //插入三个int类型数据并初始化为4
    ls.resize(6, 4);
    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;
    //插入4个int类型数据默认初始化为0
    ls.resize(10);
    for (auto num : ls)
    {
        cout << num << " ";
    }

    return 0;
}
输出结果:
1 2 3
1 2 3 4 4 4
1 2 3 4 4 4 0 0 0 0

clear()函数

使用clear()函数可以清空调用对象链表当前所有的有效数据节点

📌

注意,当链表中没有有效数据节点时clear()函数不会有任何效果,并且使用clear()函数不会删除头节点

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls;
    ls.push_back(1);
    ls.push_back(2);
    ls.push_back(3);
    ls.push_back(4);
    ls.push_back(5);

    cout << "清空前:" << endl;
    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;

    ls.clear();

    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << "清空后:" << endl;

    return 0;
}
输出结果:
清空前:
1 2 3 4 5
清空后:

清空有效数据节点不会删除头节点

list类数据操作

函数

功能

splice()

将指定对象中的数据转移到调用对象链表中的指定位置

sort()

为调用对象链表排序

unique()

去除调用对象中重复的有效数据节点

merge()

合并指定对象和调用对象的链表中的所有有效数据节点到调用对象链表中

reverse()

反转调用对象链表

splice()函数

使用splice()函数可以将指定对象中的内容拼接到调用对象的链表中的指定位置后

函数

函数原型

splice()

void splice (iterator position, list& x);

(将对象x中的所有内容拼接到调用对象position位置之前开始的位置)

void splice (iterator position, list& x, iterator i);

(将对象x中的i位置的内容拼接到调用对象position位置之前开始的位置)

void splice (iterator position, list& x, iterator first, iterator last);

(将对象x中指定区间的内容拼接到调用对象position位置之前开始的位置)

📌

使用splice()函数拼接后,指定对象的链表将不会存在被拼接至调用对象的有效数据节点

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls{ 1,2,3,4,5 };
    list<int> ls1(3, 6);

    cout << "拼接前:" << endl;
    for (auto num : ls)
    {
        cout << num << " ";
    }

    cout << endl;

    for (auto num : ls1)
    {
        cout << num << " ";
    }

    cout << endl;
    list<int>::iterator it = find(ls.begin(), ls.end(), 2);
    ls.splice(it, ls1);
    cout << "拼接后:" << endl;
    for (auto num : ls)
    {
        cout << num << " ";
    }

    cout << endl;

    for (auto num : ls1)
    {
        cout << num << " ";
    }

    cout << endl;
    return 0;
}
输出结果:
拼接前:
1 2 3 4 5
6 6 6
拼接后:
1 6 6 6 2 3 4 5

📌

注意,splice()函数中的迭代器为双向迭代器(bidirectional iterator),传递的迭代器也必须为双向迭代器或者单向迭代器(forward iterator),不可以随机迭代器(random iterator)

随机访问迭代器是特殊的双向迭代器,双向迭代器和随机访问迭代器是特殊的单向迭代器

随机访问迭代器支持以下操作:

双向迭代器支持以下操作:

单向迭代器支持以下操作:

#include <iostream>
#include <list>
#include <vector>
using namespace std;

int main()
{
    list<int> ls{ 1,2,3,4,5 };
    vector<int> v1(3, 6);

    cout << "拼接前:" << endl;
    for (auto num : ls)
    {
        cout << num << " ";
    }

    cout << endl;

    for (auto num : v1)
    {
        cout << num << " ";
    }

    cout << endl;
    list<int>::iterator it = find(ls.begin(), ls.end(), 2);
    ls.splice(it, v1);
    cout << "拼接后:" << endl;
    for (auto num : ls)
    {
        cout << num << " ";
    }

    cout << endl;

    for (auto num : v1)
    {
        cout << num << " ";
    }

    cout << endl;
    return 0;
}
报错信息:
“std::list<int,std::allocator<int>>::splice”: 没有重载函数可以转换所有参数类型

因为vector的迭代器为随机访问迭代器,所以当传入双向迭代器时会报错

sort()函数

使用sort()函数可以为调用对象的链表进行排序,底层是归并排序

📌

默认是升序排序,可以通过仿函数改变为降序(后续介绍仿函数)

函数

函数原型

sort()

void sort();

template <class Compare>

void sort (Compare comp);

📌

不同于算法库中sort()函数,因为算法库中的sort()函数为随机访问迭代器,双向迭代器不再适用

#include <iostream>
#include <list>
using namespace std;

int main()
{
    //升序
    list<int> ls{ 2,34,53,9,12,66,32 };
    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;
    ls.sort();
    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;
    //降序
    ls.sort(greater<int>());
    for (auto num : ls)
    {
        cout << num << " ";
    }
    return 0;
}
输出结果:
2 34 53 9 12 66 32
2 9 12 32 34 53 66
66 53 34 32 12 9 2

在实际使用中,如果数据量比较大时,list排序会比可以随机访问的vector类排序慢,所以一般可以考虑将list类的数据拷贝到vector类中排序,排完序后再拷贝会list中,这段过程中虽然涉及到拷贝数据的消耗,但是总体时间消耗比单独使用list中sort()函数小

#include <iostream>
#include <vector>
#include <list>
#include <ctime>
#include <algorithm>
using namespace std;

int main()
{
    srand(time(NULL));
    const int N = 10000000;//一千万个数据

    list<int> ls;
    list<int> ls1;

    //向两个链表中插入数据
    for (int i = 0; i < N; ++i)
    {
        auto e = rand();
        ls.push_back(e);
        ls1.push_back(e);
    }

    //直接使用sort()排序
    size_t begin = clock();
    ls.sort();
    size_t end = clock();

    //拷贝到vector类中排序
    size_t begin1 = clock();
    vector<int> v(ls1.begin(), ls1.end());
    sort(v.begin(), v.end());
    ls1.assign(v.begin(), v.end());
    size_t end1 = clock();

    cout << "直接排序:" << end - begin << "ms" << endl;
    cout << "拷贝后排序再拷贝:" << end1 - begin1 << "ms" << endl;

    return 0;
}
输出结果:
直接排序:14069ms
拷贝后排序再拷贝:4257ms

unique()函数

使用unique()函数可以为调用对象链表去除重复数据的有效数据节点

函数

函数原型

unique()

void unique();

📌

使用unique()函数之前必须确保链表有序

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls{ 1,2,2,1,3,2,4,5,6,6 };
    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;
    //先进行排序
    ls.sort();
    ls.unique();
    for (auto num : ls)
    {
        cout << num << " ";
    }

    return 0;
}
输出结果:
1 2 2 1 3 2 4 5 6 6
1 2 3 4 5 6

merge()函数

使用merge()函数可以将调用对象和指定对象的链表进行合并

函数

函数原型

merge()

void merge (list& x);

📌

默认按照从小到大进行合并,也可通过仿函数更改为降序

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls{ 1,2,9,5,4 };
    list<int> ls1{ 3,2,4,8,1 };
    ls.sort();
    ls1.sort();

    ls.merge(ls1);
    for (auto num : ls)
    {
        cout << num << " ";
    }

    return 0;
}
输出结果:
1 1 2 2 3 4 4 5 8 9

reverse()函数

使用reverse()函数可以逆置调用对象链表

函数

函数原型

reverse()

void reverse();

#include <iostream>
#include <list>
using namespace std;

int main()
{
    list<int> ls{ 1,2,4,5,9 };
    for (auto num : ls)
    {
        cout << num << " ";
    }
    cout << endl;
    ls.reverse();
    for (auto num : ls)
    {
        cout << num << " ";
    }

    return 0;
}
输出结果:
1 2 4 5 9
9 5 4 2 1

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1593472.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Mac环境 llamafile 部署大语言模型LLM

文章目录 Github官网本地部署 llamafile 是一种可在你自己的电脑上运行的可执行大型语言模型&#xff08;LLM&#xff09;&#xff0c;它包含了给定的开放 LLM 的权重&#xff0c;以及运行该模型所需的一切。让人惊喜的是&#xff0c;你无需进行任何安装或配置。 Github https…

CSS3新增

一些CSS3新增的功能 课程视频链接 目录 CSS3概述私有前缀长度单位remvwvhvmaxvmin 颜色设置方式rgbahslhsla 选择器动态伪类目标伪类语言伪类UI伪类结构伪类否定伪类伪元素 盒子属性box-sizing问题插播 宽度与设置的不同 resizebox-shadowopacity 背景属性background-originb…

CCS在线调试时实时修改变量值

在使用CCS调试dsp芯片时&#xff0c;发现CCS软件有一个非常好的功能&#xff0c;在仿真调试的时候可以实时修改代码中变量的值。这个功能在调试switch语句的时候非常好用&#xff0c;比如想要执行哪个case语句&#xff0c;直接在仿真界面里面修改switch语句入口参数就行。   …

机器学习周记(第三十四周:文献阅读[GNet-LS])2024.4.8~2024.4.14

目录 摘要 ABSTRACT 1 论文信息 1.1 论文标题 1.2 论文摘要 1.3 论文模型 1.3.1 数据处理 1.3.2 GNet-LS 2 相关代码 摘要 本周阅读了一篇时间序列预测论文。论文模型为GNet-LS&#xff0c;主要包含四个模块&#xff1a;粒度划分模块&#xff08;GD&#xff09;&…

回归预测 | Matlab实现WOA-BP鲸鱼算法优化BP神经网络多变量回归预测

回归预测 | Matlab实现WOA-BP鲸鱼算法优化BP神经网络多变量回归预测 目录 回归预测 | Matlab实现WOA-BP鲸鱼算法优化BP神经网络多变量回归预测预测效果基本描述程序设计参考资料 预测效果 基本描述 1.Matlab实现WOA-BP鲸鱼算法优化BP神经网络多变量回归预测&#xff08;完整源码…

通过一篇文章让你了解Linux的重要性

Linux 前言一、什么是Linux后台vs前台为何大多数公司选择使用Linux作为后台服务器 二、Linux的背景介绍UNIX发展的历史Linux发展历史开源官网发行版本DebianUbuntu红帽企业级LinuxCentOSFedoraKali Linux 三、国内企业后台和用户使用Linux现状IT服务器Linux系统应用领域嵌入式L…

容器受到攻击时该如何应对,容器安全给你答案

容器是一个软件包&#xff0c;其中包含在任何操作系统和基础架构上运行所需的所有依赖项&#xff0c;包括代码、配置文件、库和系统工具。每个容器都包含一个运行时环境&#xff0c;使应用程序能够在各种计算环境之间迁移——例如&#xff0c;从物理机迁移到云。 容器提供了许…

【C++类和对象】构造函数与析构函数

&#x1f49e;&#x1f49e; 前言 hello hello~ &#xff0c;这里是大耳朵土土垚~&#x1f496;&#x1f496; &#xff0c;欢迎大家点赞&#x1f973;&#x1f973;关注&#x1f4a5;&#x1f4a5;收藏&#x1f339;&#x1f339;&#x1f339; &#x1f4a5;个人主页&#x…

书生·浦语2.0(InternLM2)大模型实战--Day03 LMDeploy量化部署 | LLMVLM实战

课程视频&#xff1a;https://www.bilibili.com/video/BV1tr421x75B/课程文档&#xff1a;https://github.com/InternLM/Tutorial/blob/camp2/lmdeploy/README.md课程作业&#xff1a;https://github.com/InternLM/Tutorial/blob/camp2/lmdeploy/homework.md平台&#xff1a;In…

记一次IP访问MySQL失败多次被自动锁定导致无法连接问题,解决方法一条SQL足以。

&#x1f469;&#x1f3fd;‍&#x1f4bb;个人主页&#xff1a;阿木木AEcru &#x1f525; 系列专栏&#xff1a;《Docker容器化部署系列》 《Java每日面筋》 &#x1f4b9;每一次技术突破&#xff0c;都是对自我能力的挑战和超越。 前言 今天下午还在带着耳机摸鱼&#xff…

Acrobat Pro DC 2021---PDF编辑与管理,打造高效PDF工作流程 含Mac+win

Acrobat Pro DC 2021包括全面的PDF编辑、OCR识别、多种输出格式转换以及强大的文件安全性保护。用户可轻松编辑、合并、转换PDF文件&#xff0c;同时支持将扫描文档转换为可编辑的PDF。可将PDF转换为Word、Excel、PowerPoint等格式&#xff0c;提高工作效率。 Mac电脑&#xf…

Java中volatile关键字

保证了不同线程对这个变量进行操作时的可见性&#xff0c;即一个线程修改了某个变量的值&#xff0c;这新值对其他线程来说是立即可见的,volatile关键字会强制将修改的值立即写入主存。 1.volatile的可见性 一个典型的例子&#xff1a;永不停止的循环。 public class Forever…

最前沿・量子退火建模方法(1) : subQUBO讲解和python实现

前言 量子退火机在小规模问题上的效果得到了有效验证&#xff0c;但是由于物理量子比特的大规模制备以及噪声的影响&#xff0c;还没有办法再大规模的场景下应用。 这时候就需要我们思考&#xff0c;如何通过软件的方法怎么样把大的问题分解成小的问题&#xff0c;以便通过现在…

LRUCache原理及源码实现

目录 LRUCache简介&#xff1a; LRUCache的实现&#xff1a; LinkedHashMap方法实现&#xff1a; 自己实现链表&#xff1a; 前言&#xff1a; 有需要本文章源码的友友请前往&#xff1a;LRUCache源码 LRUCache简介&#xff1a; LRU是Least Recently Used的缩写&#xf…

Pixel-GS:用于3D高斯溅射的具有像素感知梯度的密度控制

Pixel-GS: Density Control with Pixel-aware Gradient for 3D Gaussian Splatting Pixel-GS&#xff1a;用于3D高斯溅射的具有像素感知梯度的密度控制 Zheng Zhang  Wenbo Hu†  Yixing Lao   老宜兴市郑张文博胡 † Tong He  Hengshuang Zhao† 赵同和恒双 †1122113311 …

1.open3d处理点云数据的常见方法

1. 点云的读取、可视化、保存 在这里是读取的点云的pcd文件&#xff0c;代码如下&#xff1a; import open3d as o3dif __name__ __main__:#1.点云读取point o3d.io.read_point_cloud("E:\daima\huawei\img\change2.pcd")print(">",point)#2.点云可视…

SpringMVC(一)【入门】

前言 学完了大数据基本组件&#xff0c;SpringMVC 也得了解了解&#xff0c;为的是之后 SpringBoot 能够快速掌握。SpringMVC 可能在大数据工作中用的不多&#xff0c;但是 SSM 毕竟是现在就业必知必会的东西了。SpringBoot 在数仓开发可能会经常用到&#xff0c;所以不废话学吧…

全网最好的JVM总结:有生命周期的JVM

1.编译 1.1 java中编译器有哪些&#xff1f; 前端编译器 javac后台即时编译器 JIT编译器静态提前编译器 &#xff08;一步到位&#xff0c;直接把java编译成二进制&#xff09; 2.2 编译过程是怎么样&#xff1f; 解析与填充符号表&#xff0c;生成语法树 &#xff08;编译…

java学习之路-继承

文章目录 前言 目录 1.1继承的概念 1.2继承有什么好处&#xff0c;为何要继承 1.3继承的语句 1.4父类成员的访问 1.4.1 子类中访问父类的成员变量 1.4.2 子类中访问父类的成员方法 1.5 super关键字 2.子类构造方法 2.1如何创建构造方法 2.2创建构造方法 3.super和this 【相同点…

Centos7 K8S 集群 - kubeadm搭建方式

机器准备 搭建环境是centos7, 四核心4G内存四台机器 一个master节点&#xff0c;一个etcd&#xff0c;两台node 机器名称IP 地址master192.168.1.127node1192.168.1.129node2192.168.1.130node3192.168.1.131 机器时间同步 各节点时间要求精确同步&#xff0c;可以直接联网…