C++的STL常用算法->常用遍历算法、常用查找算法、常用排序算法、常用拷贝和替换算法、常用算术生成算法、常用集合算法

【C++】STL常用算法 STL常用算法 阅读详情

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

//常用遍历算法  for_each
//普通函数
void print01(int val)
{
    cout << val << " ";
}
//仿函数
//函数对象
class print02
{
 public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

//for_each算法基本用法
void test01()
{
    vector<int> v;
    for (int i = 0; i < 10; i++)
    {
        v.push_back(i);
    }
    //遍历算法
    for_each(v.begin(), v.end(), print01);
    cout << endl;

    for_each(v.begin(), v.end(), print02());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用遍历算法  搬运 transform

class TransForm
{
public:
    int operator()(int val)
    {
        return val;
    }

};

class MyPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    vector<int>v;
    for (int i = 0; i < 10; i++)
    {
        v.push_back(i);
    }

    vector<int>vTarget; //目标容器

    vTarget.resize(v.size()); // 目标容器需要提前开辟空间

    transform(v.begin(), v.end(), vTarget.begin(), TransForm());

    for_each(vTarget.begin(), vTarget.end(), MyPrint());
}

int main()
{
    test01();
    system("pause");
    return 0;
}

#include<iostream>
using namespace std;
#include <algorithm>
#include <vector>
#include <string>

//常用查找算法  find

//查找  内置数据类型
void test01()
{
    vector<int> v;
    for (int i = 0; i < 10; i++)
    {
        v.push_back(i + 1);
    }
    //查找容器中是否有 5 这个元素
    vector<int>::iterator it = find(v.begin(), v.end(), 5);
    if (it == v.end())
    {
        cout << "没有找到!" << endl;
    }
    else
    {
        cout << "找到:" << *it << endl;
    }
}

class Person
{
public:
    Person(string name, int age)
    {
        this->m_Name = name;
        this->m_Age = age;
    }
    //重载==  底层find知道如何对比person数据类型
    bool operator==(const Person& p)
    {
        if (this->m_Name == p.m_Name && this->m_Age == p.m_Age)
        {
            return true;
        }
        return false;
    }

public:
    string m_Name;
    int m_Age;
};
//查找 自定义数据类型
void test02()
{
    vector<Person> v;
    //创建数据
    Person p1("aaa", 10);
    Person p2("bbb", 20);
    Person p3("ccc", 30);
    Person p4("ddd", 40);
    //放入容器中
    v.push_back(p1);
    v.push_back(p2);
    v.push_back(p3);
    v.push_back(p4);

    vector<Person>::iterator it = find(v.begin(), v.end(), p2);
    if (it == v.end())
    {
        cout << "没有找到!" << endl;
    }
    else
    {
        cout << "找到姓名:" << it->m_Name << " 年龄: " << it->m_Age << endl;
    }
}

int main()
{
    test01();
    test02();
    system("pause");
    return 0;
}

#include<iostream>
using namespace std;
#include <algorithm>
#include <vector>
#include <string>
//常用查找算法  find_if
//仿函数
class GreaterFive
{
public:
    bool operator()(int val)
    {
        return val > 5;
    }
};
//1.查找内置数据类型
void test01()
{
    vector<int> v;
    for (int i = 0; i < 10; i++)
    {
        v.push_back(i + 1);
    }
    vector<int>::iterator it = find_if(v.begin(), v.end(), GreaterFive());
    if (it == v.end())
    {
        cout << "没有找到!" << endl;
    }
    else
    {
        cout << "找到大于5的数字:" << *it << endl;
    }
}

class Person
{
public:
    Person(string name, int age)
    {
        this->m_Name = name;
        this->m_Age = age;
    }
public:
    string m_Name;
    int m_Age;
};

class Greater20
{
public:
    bool operator()(Person &p)
    {
        return p.m_Age > 20;
    }

};
//2.查找自定义数据类型
void test02()
{
    vector<Person> v;
    //创建数据
    Person p1("aaa", 10);
    Person p2("bbb", 20);
    Person p3("ccc", 30);
    Person p4("ddd", 40);

    v.push_back(p1);
    v.push_back(p2);
    v.push_back(p3);
    v.push_back(p4);
    //找年龄大于20
    vector<Person>::iterator it = find_if(v.begin(), v.end(), Greater20());
    if (it == v.end())
    {
        cout << "没有找到!" << endl;
    }
    else
    {
        cout << "找到姓名:" << it->m_Name << " 年龄: " << it->m_Age << endl;
    }
}

int main()
{
    //test01();
    test02();
    system("pause");
    return 0;
}

#include<iostream>
using namespace std;
#include <algorithm>
#include <vector>
//常用查找算法 adjacent_find
void test01()
{
    vector<int> v;
    v.push_back(1);
    v.push_back(2);
    v.push_back(5);
    v.push_back(2);
    v.push_back(4);
    v.push_back(4);
    v.push_back(3);
    //查找相邻重复元素
    vector<int>::iterator it = adjacent_find(v.begin(), v.end());
    if (it == v.end())
    {
        cout << "找不到!" << endl;
    }
    else
    {
        cout << "找到相邻重复元素为:" << *it << endl;
    }
}
int main()
{
    test01();
    system("pause");
    return 0;
}

#include<iostream>
using namespace std;
#include <algorithm>
#include <vector>
//常用查找算法 binary_search
void test01()
{
    vector<int>v;
    for (int i = 0; i < 10; i++)
    {
        v.push_back(i);
    }
    //二分查找
    //查找容器中是否有2元素
    bool ret = binary_search(v.begin(), v.end(),2);
    if (ret)
    {
        cout << "找到了" << endl;
    }
    else
    {
        cout << "未找到" << endl;
    }
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用查找算法  count
//1.查找内置数据类型
void test01()
{
    vector<int> v;
    v.push_back(1);
    v.push_back(2);
    v.push_back(4);
    v.push_back(5);
    v.push_back(3);
    v.push_back(4);
    v.push_back(4);

    int num = count(v.begin(), v.end(), 4);

    cout << "4的个数为: " << num << endl;
}

//2.查找自定义数据类型
class Person
{
public:
    Person(string name, int age)
    {
        this->m_Name = name;
        this->m_Age = age;
    }
    bool operator==(const Person & p)
    {
        if (this->m_Age == p.m_Age)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    string m_Name;
    int m_Age;
};

void test02()
{
    vector<Person> v;

    Person p1("刘备", 35);
    Person p2("关羽", 35);
    Person p3("张飞", 35);
    Person p4("赵云", 30);
    Person p5("曹操", 25);
    //将人员插入到容器中
    v.push_back(p1);
    v.push_back(p2);
    v.push_back(p3);
    v.push_back(p4);
    v.push_back(p5);
    
    Person p("诸葛亮",35);

    int num = count(v.begin(), v.end(), p);
    cout << "和诸葛亮同岁数的人员个数为: " << num << endl;
}
int main()
{
    //test01();
    test02();
    system("pause");
    return 0;
}

#include<iostream>
using namespace std;
#include <algorithm>
#include <vector>
//常用查找算法  count_if
//仿函数
class Greater4
{
public:
    bool operator()(int val)
    {
        return val >= 4;
    }
};

//统计内置数据类型
void test01()
{
    vector<int> v;
    v.push_back(1);
    v.push_back(2);
    v.push_back(4);
    v.push_back(5);
    v.push_back(3);
    v.push_back(4);
    v.push_back(4);

    int num = count_if(v.begin(), v.end(), Greater4());

    cout << "大于4的个数为: " << num << endl;
}

class Person
{
public:
    Person(string name, int age)
    {
        this->m_Name = name;
        this->m_Age = age;
    }

    string m_Name;
    int m_Age;
};

class AgeLess35
{
public:
    bool operator()(const Person &p)
    {
        return p.m_Age < 35;
    }
};
//统计自定义数据类型
void test02()
{
    vector<Person> v;

    Person p1("刘备", 35);
    Person p2("关羽", 35);
    Person p3("张飞", 35);
    Person p4("赵云", 30);
    Person p5("曹操", 25);

    v.push_back(p1);
    v.push_back(p2);
    v.push_back(p3);
    v.push_back(p4);
    v.push_back(p5);

    int num = count_if(v.begin(), v.end(), AgeLess35());
    cout << "小于35岁的个数:" << num << endl;
}

int main()
{
    //test01();
    test02();
    system("pause");
    return 0;
}

#include<iostream>
using namespace std;
#include <algorithm>
#include <vector>
#include<functional>

//常用排序算法  sort

void myPrint(int val)
{
    cout << val << " ";
}

void test01()
{
    vector<int> v;
    v.push_back(10);
    v.push_back(30);
    v.push_back(50);
    v.push_back(20);
    v.push_back(40);
    //利用sort进行升序
    //sort默认从小到大排序
    sort(v.begin(), v.end());
    for_each(v.begin(), v.end(), myPrint);
    cout << endl;
    //改变为降序
    //从大到小排序
    sort(v.begin(), v.end(), greater<int>());
    for_each(v.begin(), v.end(), myPrint);
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用排序算法 random_shuffle
class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    srand((unsigned int)time(NULL));
    vector<int> v;
    for(int i = 0 ; i < 10;i++)
    {
        v.push_back(i);
    }
    for_each(v.begin(), v.end(), myPrint());
    cout << endl;

    //利用洗牌 算法 打乱顺序
    random_shuffle(v.begin(), v.end());
    for_each(v.begin(), v.end(), myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用排序算法  merge
class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    vector<int> v1;
    vector<int> v2;
    for (int i = 0; i < 10 ; i++)
    {
        v1.push_back(i);
        v2.push_back(i + 1);
    }
    //目标容器
    vector<int> vtarget;
    //目标容器需要提前开辟空间
    vtarget.resize(v1.size() + v2.size());
    //合并  需要两个有序序列
    merge(v1.begin(), v1.end(), v2.begin(), v2.end(), vtarget.begin());
    for_each(vtarget.begin(), vtarget.end(), myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用排序算法 reverse
class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    vector<int> v;
    v.push_back(10);
    v.push_back(30);
    v.push_back(50);
    v.push_back(20);
    v.push_back(40);

    cout << "反转前: " << endl;
    for_each(v.begin(), v.end(), myPrint());
    cout << endl;

    cout << "反转后: " << endl;

    reverse(v.begin(), v.end());
    for_each(v.begin(), v.end(), myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用拷贝和替换算法 copy
class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    vector<int> v1;
    for (int i = 0; i < 10; i++)
    {
        v1.push_back(i + 1);
    }
    vector<int> v2;
    v2.resize(v1.size());
    copy(v1.begin(), v1.end(), v2.begin());

    for_each(v2.begin(), v2.end(), myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用拷贝和替换算法 replace
//仿函数
class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    vector<int> v;
    v.push_back(20);
    v.push_back(30);
    v.push_back(20);
    v.push_back(40);
    v.push_back(50);
    v.push_back(10);
    v.push_back(20);

    cout << "替换前:" << endl;
    for_each(v.begin(), v.end(), myPrint());
    cout << endl;

    //将容器中的20 替换成 2000
    cout << "替换后:" << endl;
    replace(v.begin(), v.end(), 20,2000);
    for_each(v.begin(), v.end(), myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用拷贝和替换算法 replace_if
//仿函数
class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};
//仿函数
class ReplaceGreater30
{
public:
    bool operator()(int val)
    {
        return val >= 30;
    }

};

void test01()
{
    vector<int> v;
    v.push_back(20);
    v.push_back(30);
    v.push_back(20);
    v.push_back(40);
    v.push_back(50);
    v.push_back(10);
    v.push_back(20);

    cout << "替换前:" << endl;
    for_each(v.begin(), v.end(), myPrint());
    cout << endl;

    //将容器中大于等于的30 替换成 3000
    cout << "替换后:" << endl;
    replace_if(v.begin(), v.end(), ReplaceGreater30(), 3000);
    for_each(v.begin(), v.end(), myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用拷贝和替换算法 swap
class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    vector<int> v1;
    vector<int> v2;
    for (int i = 0; i < 10; i++)
    {
        v1.push_back(i);
        v2.push_back(i+100);
    }

    cout << "交换前: " << endl;
    for_each(v1.begin(), v1.end(), myPrint());
    cout << endl;
    for_each(v2.begin(), v2.end(), myPrint());
    cout << endl;

    cout << "交换后: " << endl;
    swap(v1, v2);
    for_each(v1.begin(), v1.end(), myPrint());
    cout << endl;
    for_each(v2.begin(), v2.end(), myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用算术生成算法 accumulate

void test01()
{
    vector<int> v;
    for (int i = 0; i <= 100; i++)
    {
        v.push_back(i);
    }
    //参数3  起始累加值
    int total = accumulate(v.begin(), v.end(), 0);

    cout << "total = " << total << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

#include<iostream>
using namespace std;
#include <numeric>
#include <vector>
#include <algorithm>

//常用算术生成算法 fill

class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    vector<int> v;
    v.resize(10);
    //填充
    fill(v.begin(), v.end(), 100);

    for_each(v.begin(), v.end(), myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用集合算法 set_intersection
class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    vector<int> v1;
    vector<int> v2;
    for (int i = 0; i < 10; i++)
    {
        v1.push_back(i);
        v2.push_back(i+5);
    }

    vector<int> vTarget;
    //目标容器需要提前开辟空间
    //最特殊情况 大容器包含小容器  开辟空间  取小容器的size即可
    //取两个里面较小的值给目标容器开辟空间
    vTarget.resize(min(v1.size(), v2.size()));
    //返回目标容器的最后一个元素的迭代器地址
    //获取交集
    vector<int>::iterator itEnd =
        set_intersection(v1.begin(), v1.end(), v2.begin(), v2.end(), vTarget.begin());

    for_each(vTarget.begin(), itEnd, myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用集合算法 set_union

class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    vector<int> v1;
    vector<int> v2;
    for (int i = 0; i < 10; i++)
    {
        v1.push_back(i);
        v2.push_back(i+5);
    }

    vector<int> vTarget;
    //目标容器提前开辟空间
    //最特殊情况  两个容器没有交集,并集就是两个容器size相加
    //取两个容器的和给目标容器开辟空间
    vTarget.resize(v1.size() + v2.size());

    //返回目标容器的最后一个元素的迭代器地址
    vector<int>::iterator itEnd =
        set_union(v1.begin(), v1.end(), v2.begin(), v2.end(), vTarget.begin());

    for_each(vTarget.begin(), itEnd, myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

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

//常用集合算法 set_difference

class myPrint
{
public:
    void operator()(int val)
    {
        cout << val << " ";
    }
};

void test01()
{
    vector<int> v1;
    vector<int> v2;
    for (int i = 0; i < 10; i++)
    {
        v1.push_back(i);
        v2.push_back(i+5);
    }
    //创建目标容器
    vector<int> vTarget;
    //给目标容器开辟空间
    //最特殊情况 两个容器没有交集  取两个容器中大的size作为目标容器开辟空间
    //取两个里面较大的值给目标容器开辟空间
    vTarget.resize( max(v1.size() , v2.size()));

    //返回目标容器的最后一个元素的迭代器地址
    cout << "v1与v2的差集为: " << endl;
    vector<int>::iterator itEnd =
        set_difference(v1.begin(), v1.end(), v2.begin(), v2.end(), vTarget.begin());
    for_each(vTarget.begin(), itEnd, myPrint());
    cout << endl;

    cout << "v2与v1的差集为: " << endl;
    itEnd = set_difference(v2.begin(), v2.end(), v1.begin(), v1.end(), vTarget.begin());
    for_each(vTarget.begin(), itEnd, myPrint());
    cout << endl;
}

int main()
{
    test01();
    system("pause");
    return 0;
}

Zabbix故障排查10051端口无法启动:zabbix-server.service: main process exited, code=exited, status=1/FAILURE zabbix-server.service: main process exited, code=exited, status=1/FAILURE报错说与数据库失去连接。 阅读详情

相关推荐

[SDIO] SD card 初始化及常用命令解析(附波形,uboot代码)

目录 初始化 1.cmd 0 2.cmd8 3.cmd55 4.acmd41 5.cmd2 6.cmd3 7.cmd9 8.cmd13 9.cmd7 10.ACMD51 11.CMD6 12.CMD16 13.CMD17 14.CMD18 15.CMD12 tuning CMD19 DW_SDHCI的tuning流程 初始化 1.cmd 0 /* Reset the Card */ err = mmc_go_idle(mmc...

Lenz_s_law的开发记录本 2万+

C++提高编程(4.4)—— 常用拷贝和替换算法

5.4 常用拷贝和替换算法 学习目标: 掌握常用的拷贝和替换算法 算法简介: copy // 容器内指定范围的元素拷贝到另一容器中 replace // 将容器内指定范围的旧元素修改为新元素 replace_if // 容器内指定范围满足条件的元素替换为新元素 swap // 互换两个容器的元素 5.4.1 copy 功能描述: 容器内指定范围的元素拷贝到另一容器中

weixin_45418001的博客 380

1.深入浅出:理解三极管截止、放大和饱和状态!——参考《模拟电子技术基础》清华大学华成英主讲

幼儿园水平理解三极管截止、放大和饱和状态!书上看不懂,听课听不懂的过来! 绕不开的三极管结构 以NPN为例,晶体三极管的结构,这是很多人不想看的,但是确实是非常重要的!不看结构是理解不了工作原理的! (这样记忆:N是negative,负,代表多子为电子;P是positive,正,代表多子为空穴) 注意观察三极管的结构,有助于理解工作时的状态。 两张图结合起来看,略作解释: 1.图中空心为空穴带正...

Hardware_harder的博客 4万+

C++进阶编程 --- 5.STL常用算法

public:bool operator==(const Student& s) //重载==elseint m_Age;Student s1("小明", 18);Student s2("小红", 19);Student s3("小王", 20);Student f("小明", 18);if (it!cout

zhongziqia的博客 1437

光线追踪渲染实战:蒙特卡洛路径追踪及其c++实现

光线追踪超越了传统的图形流水线,是一种现代的渲染。光线追踪是一种基于物理的渲染方法,通过模拟光在介质中的真实表现来输出足以逼近现实的图像。光线从光源出发,经过各种反射折射,进入摄像机。通过渲染方程描述一点的颜色,并且通过蒙特卡洛方法求解渲染方程来获取最终的像素颜色。

AKGWSB 's blog 1万+

脑机接口最新发展动态报告 (2024-2025)

脑机接口动态

高山 4105

C++(243~263)STL常用算法、遍历算法(for_each,Transform)、查找算法、拷贝和替换、常用算术生成,常用集合算法。

STL常用算法一、常用遍历算法1.1 for_each1.2 transform2、常用查找算法2.1 find2.2 find_if2.3 adjacent_find2.4 binary_search2.5 count2.6 count_if三、常用排序算法3.1 sort3.2 random_shuffer3.3 merge3.4 reverse四、常用的拷贝和替换算法4.1 copy4.2 replace4.3 replace_if4.4 swap五、常用算术生成算法5.1 accumulate

believe_zi_ji的博客 232

2026快手爬虫终极指南:JA4+指纹绕过+sign全逆向+AES响应解密(附可运行代码)

快手2026反爬破解实战指南 本文深入剖析快手2026年最新反爬体系,提供完整的破解方案: 四层防御体系:从传输层(JA4+指纹)、应用层(sign参数)、设备层到行为层,90%的爬虫在前两层即被拦截 JA4+指纹绕过:使用curl_cffi模拟Chrome 124的TLS指纹,完美匹配真实浏览器特征 sign参数逆向:通过动态调试提取加密逻辑,Python实现MD5签名算法,包含参数排序和盐值处理 响应解密:破解AES-GCM加密接口数据,完整还原响应内容 技术亮点: 使用curl-impersonate

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1800

stl 中常用的算法

#include <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; //stl -常用算法 //1.常用遍历算法 //1.1for_each 遍历容器 //1.2transform 搬运容器到另一个容器中 //for_...

weixin_41874599的博客 427

SAP 实施:Waterfall vs. Agile —— 一场“结构性矛盾“的深刻比较先说结论:在 SAP 世界里,这从来不是“谁更好“的宗教问题,而是“你的项目 DNA 是什么“的战略选择。​

SAP 实施:Waterfall vs. Agile —— 一场"结构性矛盾"的深刻比较 先说结论:在 SAP 世界里,这从来不是"谁更好"的宗教问题,而是"你的项目 DNA 是什么"的战略选择。​ SAP 早已用 SAP Activate​ 给出了官方态度——它不是纯 Agile,也不是回头去搞旧 Waterfall,而是一个带质量门的混合架构。 1. 先回到本质:两者解决的是不同维度的风险 维度 Waterfall(传统 ASAP 路线)​ Agile(SCRUM/Kanban 式迭代)​

金牌架构师 336

基于 Vivado HLS 的 AC97 音频系统设计

介绍一种基于 FPGA 的 AC97 音频系统设计。系统的核心部件采用 Xilinx Atlys 的板载 Spartan6 XCSLX45 芯片,使用的工具为 Xilinx 的高层 次 综 合 技 术 Vivado HLS。首先使用 C /C + + 代码编写的算法描述系统的 FIR 滤波器; 然后按 照 Vivado HLS 编译工具的规范,将程序代码转换为 RTL 模型,快速、直接地生成对 应左右声道的 FIR IP 核和综合结果; 再结合互连的 MicroBlaze 处理器 IP 核,处理 一段立体声

qq_43416206的博客 326

C++STL常用算法(超详细!)

v1中是有4的,但是它结果显示为未找到,就是因为v1是无序的。,找到返回相邻元素的第一个位置的迭代器,找不到返回结束迭代器。,找到返回指定元素的迭代器,找不到返回结束迭代器end(),找到返回指定元素的迭代器,找不到返回结束迭代器end()注:两个容器必须是有序的,合并完之后也是一个有序序列。,也就是最特殊的那种情况--大容器和小容器无交集。,也就是最特殊的那种情况--大容器和小容器无交集。,也就是最特殊的那种情况--大容器包小容器。返回值:并集中最后一个元素的迭代器位置。

qq_62855390的博客 3868

自己的搭建的slam机器人建图导航测试

1、前言 这里是对自己搭建的slam机器人建图导航的功能测试,原本并不想写这一篇的,因为每个小伙伴的需求都不一样,但是发现还是有同学有需求,于是就有了这一篇。本篇属于说明分享类文章,不涉及细节解释。按照步骤操作即可。 本次测试需要建图算法my_slam_gmapping、导航框架navigation、以及explore_lite功能包、mbot_teleop键盘控制功能包等。 环境:ubuntu mate 16.04 + ROS Kinetic 功能包下载:在公众号:小白学移动机器人,发送:建图导航测试,即

「小白学移动机器人」一个专注分享移动机器人相关知识的公众号! 8700

熬夜爆肝!C++核心STL常用算法汇总整理【2W字干货预警 建议收藏】

C++核心STL常用算法1 STL- 常用算法1.1 常用遍历算法1.1.1 for_each1.1.2 transform1.2 常用查找算法1.2.1 find1.2.2 find_if1.2.3 adjacent_find1.2.4 binary_search1.2.5 count1.2.6 count_if1.3 常用排序算法1.3.1 sort1.3.2 random_shuffle1.3.3 merge1.3.4 reverse1.4 常用拷贝和替换算法1.4.1 copy1.4.2 repla

hhladminhhl的博客 4680

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

STL常用算法——C++

方式一:传入普通函数(printf1) 方式2:利用仿函数,传入匿名函数对象 注意:函数只需要传入函数名就行,但是仿函数需要传入函数对象。for_each在实际开发中是最常用的一个算法,需要熟练掌握 注意:转运之前,需要将目标对象用resize()也开辟相同的空间。 注意:find的返回值是迭代器 底层原理就是二分查找,二分查找需要提前排序好才能用,二分查找需要的算力少。 如果是无序序列,结果未知 总结:对于统计自定义数据类型的时候,需要配合重载operator==

2401_84315007的博客 2400

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

【C++ 二十】STL:遍历、查找、排序、拷贝和替换、算术生成、集合算法

本文包含STL常用遍历算法(for_each、transform)、STL常用查找算法(find、find_if、adjacent_find、binary_search、count、count_if)、STL常用排序算法(sort、random_shuffle、merge、reverse)、STL常用拷贝和替换算法(copy、replace、replace_if、swap)、STL常用算术生成算法(accumulate、fill)、STL常用集合算法(set_intersection、set_union、s

qq_45138120的博客 960

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

c++学习笔记-提高篇-STL-常用六大算法(遍历、查找、排序、拷贝和替换、算术生成、集合算法)

算法主要由头文件,常用的遍历算法、查找算法、排序算法、拷贝和替换算法、算术生成算法以及集合算法的使用和示例

qq_26572229的博客 1252

C++:STL的常用算法(遍历/查找/排序/拷贝/替换/算数生成算法/集合算法)

1 STL常用算法 1.1 常用遍历算法 1.1.1 for_each 1.1.2 transform 1.2 常用查找算法 1.2.1 find 1.2.2 find_if 1.2.3 adjacent_find 1.2.4 binary_search 1.2.5 count 1.2.6 count_if 1.3 常用排序算法 1.3.1 sort 1.3.2 random_shuffle 1.3.3 merge 1.3.4 reverse 1.4 常用拷贝和替换算法 1.4.1 copy 1.4.2 r

我是程序员Amin,关注我,带你学习有趣的计算机知识 1208

C++模板与STL【常用算法】

推荐关注博主,随时获取关于C++的最新技术分享。

m0_51574586的博客 1481

c++提高篇——STL常用算法

算法主要是由头文件 组成。是所有STL头文件中最大的一个,范围涉及到比较、交换、查找、追历操作、复制、修改等等。体积很小,只包括几个在序列上面进行简单数学运算的模板函数。定义了—些模板类.用以声明函数对象。

qq_52302919的博客 2950

C++ STL常用算法:遍历、查找、排序、拷贝与替换、算术生成、集合算法

文章目录0 STL算法1 常用遍历算法【for_each、transform】1.1 for_each【遍历容器元素】1.2 transform【将源容器的元素搬运至目标容器】2 常用查找算法【find、find_if、adjacent_find、binary_search、count、count_if】2.1 find2.2 find_if2.3 adjacent_find2.4 binary_search2.5 count2.6 count_if3 常用排序算法【sort、random_shuffle、

NewsomTech 829

STL常用算法笔记

STL常用算法笔记、方便查阅、b站黑马程序员的c++

知道的越多,不知道的越多 1276

C++阶段05笔记06【C++提高编程资料(常用遍历算法、常用查找算法、常用排序算法、常用拷贝和替换算法、常用算术生成算法、常用集合算法)】

C++阶段05笔记06【C++提高编程资料(常用遍历算法、常用查找算法、常用排序算法、常用拷贝和替换算法、常用算术生成算法、常用集合算法)】

upward 896

STL常用算法---C++

概述算法主要是由头文件<numeric>组成。是所有STL头文件中最大的一个,范围涉及到比较、 交换、查找、遍历操作、复制、修改等等;<numeric>体积很小,只包括几个在序列上面进行简单数学运算的模板函数;定义了一些模板类,用以声明函数对象。

weixin_63685622的博客 1098

6 c++提高——STL常用算法

【代码】6 c++提高——STL常用算法。

xcxhzjl的博客 1225

C++提高编程——STL:常用算法

算法主要是由头文件。

weixin_63866037的博客 1488
上一篇: C++的STL-函数对象->函数对象(->概念、使用)、谓词(->谓词概念、一元谓词、二元谓词)、内建函数对象(->内建函数对象意义、算术仿函数、关系仿函数、逻辑仿函数)
下一篇: 在ubuntu22.04系统上用pycharm编写第一个ros2程序
�西瓜�
博客等级 码龄8年 485粉丝 79原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

�西瓜�

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值