0815,析构函数,拷贝构造函数,赋值运算符函数

news2024/9/21 22:30:09


来自同济医院的问候

目录

01:对象创建

001.cc

003size.cc 

02:对象销毁

004pointer.cc

005destroytime.cc

03:本类型对象的复制

3.1 拷贝构造函数

006cp.cc

007cptime.cc

008recursion.cc

009rightleft.cc

3.2 赋值运算符函数

010thispointer.cc

 011operator.cc

3.3 三合成原则

作业喵:

01,关于对象概念的描述中,( )是错误的。   A

02,有关析构函数的说法不正确的是( )  C

03,对类的构造函数和析构函数描述正确的是( )。  A

04,有关类的说法不正确的是____。    D

05,一个空类对象占据的空间有多大?会自动创建哪些函数呢?

06,什么情况下,会调用拷贝构造函数?

07,什么是拷贝构造函数,其形态是什么,参数可以修改吗?

08,什么是赋值运算符函数,其形态是什么?什么情况下需要手动提供赋值运算符函数呢?

09,写出下面程序的运行结果()

10,设已经有A,B,C,D 4个类的定义,程序中A,B,C,D析构函数调用顺序为? ABDC(坏)

11,定义一个学生类,其中有3个数据成员:学号、姓名、年龄,以及若干成员函数。同时编写main函数,使用这个类,实现对学生数据的复制、赋值与输出。

01:对象创建

001.cc

#include <iostream>
using std::cout;
using std::endl;

class Point{
public:
    Point()
        :_ix(0),_iy(0)
    {cout<<"Point()"<<endl;}
    Point(int x,int y=1)
        :_ix(x),_iy(y)
    {cout<<"Point(int ,int)"<<endl;}
    //不是严格意义的初始化,本质是赋值
    /* Point(int x,int y){ */
    /*     _ix=x; */
    /*     _iy=y; */
    /*     cout<<"Point(int ,int )"<<endl;} */
    void print(){ cout<<_ix<<"\t\t"<<_iy<<endl; }
private:
    int _ix;
    int _iy;
};
void test(){
    Point pt1;
    Point pt2(5);
    Point pt(1,2);
    pt1.print();
    pt2.print();
    pt.print();
}

int main(void)
{
    test();
    return 0;
}

003size.cc 

#include <iostream>
using std::cout;
using std::endl;

#pragma pack(4)

class A{
    int _num;
    double _price;
};
class B{
    int _num;
    int _price;
};
class C{
    int _num;
    int _num1;
    double _price;
};
class D{
    int _num;
    double _price;
    int _num1;
};
class E{
    double _e;
    char _eArr[20];
    double _e1;
    int _e2;
};
class F{
    char _fArr[20];
};
class G{
    int num;
};
class H{
    char _gArr[20];
    int _g1;
    int _g2;
};
class I {};
void test(){
    cout<<sizeof(A)<<endl;
    cout<<sizeof(B)<<endl;
    //16 8
    cout<<sizeof(C)<<endl;
    cout<<sizeof(D)<<endl;
    //16 24
    cout<<sizeof(E)<<endl;
    cout<<sizeof(F)<<endl;
    //48 24
    cout<<sizeof(G)<<endl;
    cout<<sizeof(H)<<endl;

    cout<<endl;
    I i1,i2;
    cout<<&i1<<" "<<&i2<<endl;
    cout<<sizeof(I)<<endl;
}

int main(void)
{
    test();
    return 0;
}

02:对象销毁

004pointer.cc

#include <iostream>
#include <string.h>
using std::cout;
using std::endl;

class Computer{
public:
    Computer(const char* brand,double price)
        : _brand(new char[strlen(brand)+1]())
        , _price(price)
    {
        strcpy(_brand,brand);// 否则没有赋值喵,不输出
        cout<<"Computer"<<endl;}
    ~Computer(){
        if(_brand){
            delete []  _brand;  //coution
             _brand=nullptr;   //加上,信任行为喵
        }
        cout<<"~Computer"<<endl;
    }
    void printBrandPrice(){
        cout<<"brand:"<<_brand<<"\t\t";
        cout<<"price:"<<_price<<endl;
    }
private:
    /* char _brand[20]; */
    char* _brand;
    double _price;
};

void test(){
    Computer pc("dell",20000);
    pc.printBrandPrice();

    //对象销毁时一定会调用析构函数,析构函数执行完,对对象没有被销毁
    //defecate indiscriminately 
    pc.~Computer();
    /* pc.printBrandPrice();  //locked */
    cout<<"over "<<endl;
}
void test01(){
    const char *p="i love xixi";
    int * pp=nullptr;
    cout<<p<<endl;
    cout<<pp<<endl; //0
    p=nullptr;
    //C++会自动访问char*类型指针,此处访问了空指针
    /* cout<<p<<endl; */
    cout<<"OK OK OK"<<endl;
}
int main(void)
{
    test();
    test01();
    return 0;
}

005destroytime.cc

#include <iostream>
#include <string.h>
using std::cout;
using std::endl;

class Computer{
public:
    Computer(const char* brand,double price)
        : _brand(new char[strlen(brand)+1]())
        , _price(price)
    {
        strcpy(_brand,brand);// 否则没有赋值喵,不输出
        cout<<_brand<<"\t\t"<<"Computer"<<endl;
    }
    ~Computer(){
        cout<<_brand<<"\t\t";
        if(_brand){
            delete []  _brand;  //coution
             _brand=nullptr;   //加上,信任行为喵
        }
        cout<<"~Computer"<<endl;
    }
    void printBrandPrice(){
        cout<<_brand<<"\t";
        cout<<_price<<endl;
    }
private:
    /* char _brand[20]; */
    char* _brand;
    double _price;
};

Computer pc_static("huipu__1",40000);
void test(){
    Computer pc("dell__2",20000);
    pc.printBrandPrice();

    Computer pc_kaixin("honor__3",0);
    pc_kaixin.printBrandPrice();

    static Computer pc_jiajia("vsus__4",10000);
    pc.printBrandPrice();
    pc_jiajia.printBrandPrice();
    pc_static.printBrandPrice();

    Computer* p_new=new Computer("lengion__5",8000);
    p_new->Computer::printBrandPrice();
    delete p_new;
    p_new=nullptr;
    //坏  后创建的先销毁
}
void test01(){
}
int main(void)
{
    test();
    test01();
    return 0;
}

03:本类型对象的复制

3.1 拷贝构造函数

006cp.cc

#include <iostream>
#include <string.h>
using std::cout;
using std::endl;

class Computer{
public:
    Computer(const char* brand,double price)
        : _brand(new char[strlen(brand)+1]())
        , _price(price)
    {
        strcpy(_brand,brand);// 否则没有赋值喵,不输出
        cout<<_brand<<"\t\t"<<"Computer"<<endl;
    }
    Computer(const Computer & pc)
        : _brand(new char[strlen(pc._brand)+1]())
        , _price(pc._price)
    {
        strcpy(_brand,pc._brand);// 否则没有赋值喵,不输出
        cout<<_brand<<"\t\t"<<"Copy  Computer"<<endl;
    }
    ~Computer(){
        cout<<_brand<<"\t\t";
        if(_brand){
            delete []  _brand;  //coution
             _brand=nullptr;   //加上,信任行为喵
        }
    }
    void printBrandPrice(){
        cout<<_brand<<"\t";
        cout<<_price<<endl;
    }
private:
    /* char _brand[20]; */
    char* _brand;
    double _price;
};

void test(){
    int x=10;
    int y=x;
    cout<<x<<endl;
    cout<<y<<endl;

    Computer pc("dell",20000);
    pc.printBrandPrice();
    /* Computer pp=pc; */
    Computer pp(pc);
    pp.printBrandPrice();
    //坏,double free
    //original cpy浅拷贝喵

}


int main(void)
{
    test();
    return 0;
}

007cptime.cc

#include <iostream>
using std::cout;
using std::endl;

class Point{
public:
    Point()
        :_ix(0),_iy(0)
        {cout<<"Point()"<<endl;}
    Point(int x,int y=1)
        :_ix(x),_iy(y)
        {cout<<"Point(int ,int)"<<endl;}
    Point(const Point & p)
        :_ix(p._ix),_iy(p._iy)
        {cout<<"Point(Point &)"<<endl;}
    void print(){ cout<<_ix<<"\t\t"<<_iy<<endl; }
private:
    int _ix;
    int _iy;
};

//Point p=pt3
void func(Point p){
    p.print();
}
//第二种调用时机 实参和形参都是对象(用实参初始化形参的过程也会调用拷贝构造)
//避免多余复制,写成引用形式
void func01(Point &  p){
    p.print();
}
Point pp(258,258);
Point func02(){ return pp; }
//函数的返回值时对象时,执行return语句会调用拷贝构造
Point & func03(){ return pp; }
//避免这次复制可以将返回值写为引用
//caution live_time

void test(){
    Point pt1;
    Point pt2(5);
    Point pt(1,2);
    Point pt3(pt1);
    //第一种调用时机 初始化

    cout<<endl;
    func(pt3);
    func01(pt3);
    //第2种调用时机 

    cout<<endl;
    func03().print();
    func02().print();
    //第3种调用时机 

    /* pt1.print(); */
    /* pt2.print(); */
    /* pt.print(); */
    /* pt3.print(); */
}

int main(void)
{
    test();
    return 0;
}

008recursion.cc

#include <iostream>
using std::cout;
using std::endl;

class Point{
public:
    Point()
        :_ix(0),_iy(0)
        {cout<<"Point()"<<endl;}
    Point(int x,int y=1)
        :_ix(x),_iy(y)
        {cout<<"Point(int ,int)"<<endl;}
    /* Point(const Point & p) */
    /*     :_ix(p._ix),_iy(p._iy) */
    /*     {cout<<"Point(Point &)"<<endl;} */

    /* Point( Point & p) */
    /*     :_ix(p._ix),_iy(p._iy) */
    /*     {cout<<"Point(Point &)"<<endl;} */
    //保证右操作数不被修改,为了能够复制临时对象的

    Point(const Point  p)
        :_ix(p._ix),_iy(p._iy)
        {cout<<"Point(Point &)"<<endl;}
    //const Point p=pt1,触发拷贝构造函数,陷入递归拷贝喵
    void print(){ cout<<_ix<<"\t\t"<<_iy<<endl; }
private:
    int _ix;
    int _iy;
};


void test(){
    Point pt1(30,50);
    Point pt3(pt1);
    pt1.print();
    /* pt3.print(); */
    //error 

    /* Point pt4=Point(20,20); */
    /* pt4.print(); */
    //坏,我的好想能跑
}

int main(void)
{
    test();
    return 0;
}

009rightleft.cc

#include <iostream>
using std::cout;
using std::endl;

class Point{
public:
    Point()
        :_ix(0),_iy(0)
        {cout<<"Point()"<<endl;}
    Point(int x,int y=1)
        :_ix(x),_iy(y)
        {cout<<"Point(int ,int)"<<endl;}
    Point(const Point & p)
        :_ix(p._ix),_iy(p._iy)
        {cout<<"Point(Point &)"<<endl;}
    void print(){ cout<<_ix<<"\t\t"<<_iy<<endl; }
private:
    int _ix;
    int _iy;
};


void test(){
    int a=10;
    int b=20;
    cout<<&a<<endl;
    cout<<&(++a)<<endl;
    //左值  能取地址
    /* cout<<&(a++)<<endl; */
    /* cout<<&(a+b)<<endl; */
    //右值 不能 (临时变量/匿名对象,临时对象,字面值
    //&1  存在与指令系统,不存在内存中

    Point pt(1,1);
    cout<<&pt<<endl;

    cout<<endl;
    int & ref=a;
    const int & ref1=b;
    /* int & ref2=a+b; */
    //no const=left
    //const = left or right
    const int & ref4=a+b;
    /* printf("%p\n",ref); */
    /* printf("%p\n",ref1); */
    /* printf("%p\n",ref4); */
}

int main(void)
{
    test();
    return 0;
}

3.2 赋值运算符函数

010thispointer.cc

#include <iostream>
using std::cout;
using std::endl;

class Point{
public:
    Point()
        :_ix(0),_iy(0)
        {cout<<"Point()"<<endl;}
    Point(int x,int y=1)
        :_ix(x),_iy(y)
        {cout<<"Point(int ,int)"<<endl;}
    Point(const Point & p)
        :_ix(p._ix),_iy(p._iy)
        {cout<<"Point(Point &)"<<endl;}
    //Point * const this
    //不能修改指向,”本对象“的地址
    //隐藏成员函数参数
    Point & operator=(const Point & p){
        cout<<"operator="<<endl;
        /* this->_ix=p._ix; */
        /* this->_iy=p._iy; */
        _ix=p._ix;_iy=p._iy;
        return *this;
    }
    void print(){ cout<<_ix<<"\t\t"<<_iy<<endl; }
private:
    int _ix;
    int _iy;
};


void test(){
    Point p(10,30);
    Point p1;
    p1.print();
    p1=p;
    /* pt.operator=(pt2);//本质形式 */
    p1.print();

    cout<<endl;
    int x=10,y=100;
    cout<<&(x=y)<<endl;
    cout<<&x<<endl;
}

int main(void)
{
    test();
    return 0;
}

 011operator.cc

#include <iostream>
#include <string.h>
using std::cout;
using std::endl;

class Computer{
public:
    Computer(const char* brand,double price)
        : _brand(new char[strlen(brand)+1]())
        , _price(price)
    {
        strcpy(_brand,brand);// 否则没有赋值喵,不输出
    }
    Computer(const Computer & pc)
        : _brand(new char[strlen(pc._brand)+1]())
        , _price(pc._price)
    {
        strcpy(_brand,pc._brand);// 否则没有赋值喵,不输出
    }
    Computer & operator=(const Computer & c){
        cout<<"operator ="<<endl;
        if(this!=&c){
            //1 考虑自赋值的情况
            delete [] _brand;
            //2  回收原本管理的堆空间
            _brand=new char[strlen(c._brand)+1]();
            strcpy(_brand,c._brand);
            //3  深拷贝
            _price=c._price;
        }
        return *this;
        //4  返回本对象
    }
    ~Computer(){
        if(_brand){
            delete []  _brand;  //coution
             _brand=nullptr;   //加上,信任行为喵
        }
    }
    void printBrandPrice(){
        cout<<_brand<<"\t";
        cout<<_price<<endl;
    }
private:
    /* char _brand[20]; */
    char* _brand;
    double _price;
};

void test(){

    Computer pc("dell",20000);
    Computer pc1("cici",20000);
    pc.printBrandPrice();
    /* Computer pp=ps; */
    Computer pp(pc);
    pp.printBrandPrice();
    //坏,double free
    //original cpy浅拷贝喵
    
    pc=pc;
    pc.printBrandPrice();
    pc=pc1;
    pc.printBrandPrice();

}


int main(void)
{
    test();
    return 0;
}

3.3 三合成原则

作业喵:

01,关于对象概念的描述中,( )是错误的。   A

  • A对象就是C语言中的结构体

  • B对象是状态和操作的封装体

  • C对象之间的信息传递是通过消息进行的

  • D对象是某个类的一个实例

02,有关析构函数的说法不正确的是( )  C

  • A析构函数有且只有一个

  • B析构函数无任何函数类型

  • C析构函数和构造函数一样可以有形参

  • D析构函数的作用是在对象被撤销时收回先前分配的内存空间

03,对类的构造函数和析构函数描述正确的是( )。  A

  • A构造函数可以重载,析构函数不能重载

  • B构造函数不能重载,析构函数可以重载

  • C构造函数可以重载,析构函数也可以重载

  • D构造函数不能重载,析构函数也不能重载

04,有关类的说法不正确的是____。    D

  • A类是一种用户自定义的数据类型

  • B只有类中的成员函数才能存取类中的私有数据

  • C在类中,如果不作特别说明,所有的数据均为私有类型

  • D在类中,如果不作特别说明,所有的成员函数均为公有类型

05,一个空类对象占据的空间有多大?会自动创建哪些函数呢?

空类:1个字节,仅仅是编译器的一种占位机制

自动创建的函数:默认无参构造,默认析构,默认拷贝构造(浅拷贝),赋值运算符函数(浅拷贝的那种喵)

06,什么情况下,会调用拷贝构造函数?

1,用已经存在的对象给新建的对象初始化

(以下为不看代码十分抽象内容)

2,函数参数(实参和形参的类型都是对象),形参与实参结合时(实参初始化形参)
避免不必要的拷贝,可以使用引用作为参数

3,函数的返回值是对象(return 会 copy)
避免多余拷贝,用引用作为返回值,确保返回值的生命周期大于函数的生命周期

07,什么是拷贝构造函数,其形态是什么,参数可以修改吗?

1,用一个已经存在的同类型的对象来初始化新对象的 构造函数

2,类名  (const 类名 & )

3,不可以
3.1  不可以去掉引用符号(遇到第二种调用时机“形参实参都是对象,用实参初始化形参”的时候,会再一次调用拷贝构造,导致递归调用
3.2  不可以去掉const   (1,确保右操作数的数据成员不会被改变,2,为了能够赋值临时对象的内容,非const引用不能绑定临时变量)

08,什么是赋值运算符函数,其形态是什么?什么情况下需要手动提供赋值运算符函数呢?

1,用已经创建的对象给另一个对象赋值的时候,会调用赋值运算函数(没有自定义时,系统会提供一个默认版本(浅拷贝版本))

2,类名 & operator =   (const 类名 &)

3,当拷贝构造,析构函数,赋值运算符手动定义了其中任何一个,其他两个也都需要手动定义

09,写出下面程序的运行结果()

class Sample 
{
	int i;
public:
	Sample();
	Sample(int val);
	void Display();
	~Sample();
};

Sample::Sample() 
{
    cout << "Constructor1" << endl;
    i=0;
}

Sample::Sample(int val) 
{
    cout << "Constructor2" << endl;
    i=val;
}

void Sample::Display() 
{
    cout << "i=" << i << endl;
}

Sample::~Sample() 
{
    cout << "Destructor" << endl;
}

int main() 
{
    Sample a, b(10);
    a.Display();
    b.Display();
	 
    return 0;
}

Constructor1
Constructor2
i=0
i=10
Destructor
Destructor 

10,设已经有A,B,C,D 4个类的定义,程序中A,B,C,D析构函数调用顺序为? ABDC(坏)

C c;
int main()
{
    A *pa=new A();
    B b;
    static D d;
    delete pa;
    return 0;
}

A  B  D  C  (坏,后创建的先销毁

1,堆对象,delete删除时

2,全局对象,整个程序结束时

3,静态对象,整个程序结束时

4,局部对象,程序离开局部对象的作用域时

11,定义一个学生类,其中有3个数据成员:学号、姓名、年龄,以及若干成员函数。同时编写main函数,使用这个类,实现对学生数据的复制、赋值与输出。

#include <iostream>
#include <string.h>
using std::cout;
using std::endl;

class Student{
public:
    Student(int id,int age,const char* name)
        :_id(id),_age(age)
        ,_name(new char[strlen(name)+1]())
        {strcpy(_name,name);}
    Student(const Student & s)
        :_id(s._id),_age(s._age)
        ,_name(new char[strlen(s._name)+1]())
        {strcpy(_name,s._name);}
    Student & operator=(const Student & s){
        if(this!=&s){
            _id=s._id;_age=s._age;
            delete [] _name;
            _name=new char[strlen(s._name)]();
            strcpy(_name,s._name);
        }
        return *this;
    }
    ~Student(){
        cout<<_name<<" ";
        if(_name){
            delete [] _name;
            _name=nullptr;
        cout<<"love xixi"<<endl;
        }
    }
    void printStudent(){
        cout<<_id<<"\t"<<_age<<"\t"<<_name<<endl;
    }
private:
    int _id;
    int _age;
    char* _name;
};
void test(){
    Student jia(1,21,"jiajia");
    jia.printStudent();
    Student kai(1,21,"kaixin");
    jia.printStudent();
    Student hui(kai);
    hui.printStudent();
    hui=jia;
    hui.printStudent();
}

int main(void)
{
    test();
    return 0;
}

1    21    jiajia
1    21    jiajia
1    21    kaixin
1    21    jiajia
jiajia love xixi
kaixin love xixi
jiajia love xixi     //只调用了三次析构函数喵    是我  en~~~?

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

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

相关文章

8.15 Day20 Windows服务器(Windows service 2008 R2)上域的搭建 (3)

1、域策略配置 1.1 DC服务端的策略配置 1.1.1 下放权限 由于各部门经理的电脑上并不存在对应的工具&#xff0c;即便授予权限也无法对各自部门进行管理 如果经理只有几个&#xff0c;管理员可以一一为其配置&#xff0c;但如果一个公司有几十个经理&#xff0c;则会变得相当冗…

测试用例的设计

*涉及概念来源于《软件测试的艺术》 目录 一、为什么要设计测试用例&#xff1f; 二、黑盒测试与白盒测试介绍 三、测试用例常见设计方法 1.黑盒测试(功能测试) 2.白盒测试(结构测试) 四、测试策略 五、测试用例怎么写 一、为什么要设计测试用例&#xff1f; 由于时间…

C语言传递指针给函数

C 语言允许您传递指针给函数&#xff0c;只需要简单地声明函数参数为指针类型即可。 下面的实例中&#xff0c;我们传递一个无符号的 long 型指针给函数&#xff0c;并在函数内改变这个值 实例1&#xff1a;获取系统的时间值 能接受指针作为参数的函数&#xff0c;也能接受数…

【Vue3】路由Params传参

【Vue3】路由Params传参 背景简介开发环境开发步骤及源码总结 背景 随着年龄的增长&#xff0c;很多曾经烂熟于心的技术原理已被岁月摩擦得愈发模糊起来&#xff0c;技术出身的人总是很难放下一些执念&#xff0c;遂将这些知识整理成文&#xff0c;以纪念曾经努力学习奋斗的日…

Vue2移动端(H5项目)项目基于vant封装图片上传组件(支持批量上传、单个上传、回显、删除、预览、最大上传数等功能)---解决批量上传问题

一、最终效果 二、参数配置 1、代码示例&#xff1a; <t-uploadfileList"fileList":showFileList"showFileList"showFile"showFile":showFileUrl"showFileUrl"/>2、配置参数&#xff08;TUpload Attributes&#xff09;继承va…

vulnhub系列:DC-1

vulnhub系列&#xff1a;DC-1 靶机下载 一、信息收集 nmap 扫描存活&#xff0c;根据 mac 地址寻找 IP nmap 192.168.23.0/24nmap 扫描端口 nmap 192.168.23.141 -p- -Pn -sV -Odirsearch 目录扫描 python3 dirsearch.py -u http://192.168.23.141/访问80端口 查看 wappa…

数据资产三次入表理论

数据资产三次入表理论 数据资产入表三大阶段详见图。 初次入表&#xff1a;底层资产入表 初次入表主要指的是企业将已实际形成的底层原始数据资源&#xff0c;按照《企业数据资源相关会计处理暂行规定》的要求&#xff0c;首次纳入会计层面的企业资产库。这一阶段工作的完成&am…

8.16 day bug

bug1 题目没看仔细 额外知识 在 Bash shell 中&#xff0c;! 符号用于历史扩展功能。当你在命令行中输入 ! 后跟一些文本时&#xff0c;Bash 会尝试从你的命令历史中查找与该文本相匹配的命令。这是一种快速重用之前执行过的命令的方法。 如何使用历史扩展 基本用法: !strin…

进程间通信—无名管道

gg shiftg快速对齐 加锁顺序问题时&#xff0c;如果解锁了&#xff0c;两个同时申请抢锁&#xff0c;谁抢到了运行谁&#xff0c;循环迭代时释放锁也是同时申请锁&#xff0c;循环部分如果没抢到锁就进入循环等待 总结: IPC 进程间通信 interprocess communicate //signal…

【阿卡迈防护分析】Vueling航空Akamai破盾实战

文章目录 1. 写在前面2. 风控分析3. 破盾实战 【&#x1f3e0;作者主页】&#xff1a;吴秋霖 【&#x1f4bc;作者介绍】&#xff1a;擅长爬虫与JS加密逆向分析&#xff01;Python领域优质创作者、CSDN博客专家、阿里云博客专家、华为云享专家。一路走来长期坚守并致力于Python…

Elasticsearch新增和删除索引中的字段

在ES中&#xff0c;增加字段相对比较容易&#xff0c;因为ES支持动态映射&#xff08;Dynamic Mapping&#xff09;。 当索引中新增文档时&#xff0c;ES可以根据文档中的字段自动创建对应的映射关系。如果新字段类型与已有字段类型不同&#xff0c;ES会自动将已有字段类型转换…

2024-2025年最值得选的Java计算机毕业设计选题大全:800个热门选题

一、前言 博主介绍&#xff1a; ✌我是阿龙&#xff0c;一名专注于Java技术领域的程序员&#xff0c;全网拥有10W粉丝。作为CSDN特邀作者、博客专家、新星计划导师&#xff0c;我在计算机毕业设计开发方面积累了丰富的经验。同时&#xff0c;我也是掘金、华为云、阿里云、InfoQ…

选择排序(附动图)

1.思路 基本思想&#xff1a; 每一次从待排序的数据元素中选出最小&#xff08;或最大&#xff09;的一个元素&#xff0c;存放在序列的起始位置&#xff0c;直到全部待排序的数据元素排完 。 1.1双向选择排序&#xff08;升序&#xff09; 头尾指针&#xff08;索引&#xf…

Excel求和方法之

一 SUM&#xff08;&#xff09;&#xff0c;选择要相加的数,回车即可 二 上面的方法还不够快。用下面这个 就成功了 三 还有一种一样快的 选中之后&#xff0c;按下Alt键和键&#xff08;即Alt&#xff09;

三种生成模型

三种生成模型&#xff08;GAN,VAE,FLOW&#xff09; 什么是生成模型&#xff1f; 图像、文本、语音等数据&#xff0c;都可以看做是从一个复杂分布中采样得到的。 一个简单的分布随机分布,经过一系列复杂的变换(Generator)之后变成复杂分布. 从简单分布中随机采样一个z,经过G后…

新版本源2.0大模型发布:Yuan2-2B-July-hf

​ 引言 近日&#xff0c;浪潮信息的新一代基础语言大模型源2.0 迎来了重要更新。浪潮信息正式发布了 Yuan2-2B-July-hf 模型&#xff0c;标志着源2.0系列模型在性能和功能上的进一步提升。这一版本将为开发者和研究人员提供更强大的工具&#xff0c;以满足各种语言处理需求。…

武汉流星汇聚:携手亚马逊,全球电商中破浪前行,跨境业务加速崛起

在全球电商的浩瀚星空中&#xff0c;亚马逊无疑是最耀眼的星辰之一&#xff0c;其无与伦比的市场规模、卓越的用户体验以及强大的品牌影响力&#xff0c;为全球卖家铺设了一条通往成功的康庄大道。而在这条道路上&#xff0c;武汉流星汇聚电子商务有限公司作为一颗迅速崛起的新…

libnl教程(1):订阅内核的netlink广播通知

文章目录 前言目标netlink kernel multicast notifications订阅内核的链路(link)变化通知示例代码函数使用难点问题 前言 我之前整理过&#xff1a;netlink 简介。 netlink 是 libnl 的基础。 在开始之前&#xff0c;需要先翻看一遍官方文档&#xff1a;Netlink Library (li…

centos从home分区分配空间到根分区

在安装centos系统时如果采用默认自动分区&#xff0c;则会默认只给根分区分配50G空间&#xff0c;其余多余的会被分配到home分区&#xff0c;而作为家用服务器或仅个人使用的话&#xff0c;为了方便往往根分区会不够用而home分区几乎没使用。 先看下现在的磁盘结构和容量(xfs文…

第八篇 WAV文件格式

WAVE PCM soundfile format WAV即WAVE&#xff0c;WAVE文件是计算机领域最常用的数字化声音文件格式之一&#xff0c;它是微软专门为Windows系统定义的波形文件格式&#xff08;Waveform Audio&#xff09;&#xff0c;其扩展名为"*.wav"。 最基本的WAVE文件…