C++——类和对象(中)完结
赋值运算符重载
运算符重载
日期类实现运算符重载
operator<运算符的实现
Date.h Date.cpp test.cpp 三个文件实现
Date.h#include<iostream>using namespace std;class Date
{
public:Date(int year = 1, int month = 1, int day = 1);void Print();bool operator<(const Date& d);private:int _year;int _month;int _day;
};Date.cpp#include"Date.h"Date::Date(int year, int month , int day)
{_year = year;_month = month;_day = day;
}void Date::Print()
{cout << _year << "-" << _month << "-" << _day << endl;
}bool Date::operator<(const Date& d)
{if (_year < d._year){return true;}else if (_year == d._year && _month < d._month){return true;}else if (_year == d._year && _month == d._month && _day < d._day){return true;}return false;
}test.cpp
#include"Date.h"void Test1()
{Date d1(2023, 11, 2);Date d2(2023, 11, 3);cout << (d1 < d2) << endl;}int main()
{Test1();return 0;
}
因为d1是自定义出来的对象,运算符不能识别自定义类型对象,只能识别内置类型,因此出现了运算符重载 operator+运算符。根据自己需要来定义返回值的不同 比如上面比较大小 返回真假即可
operator==运算符实现
Date.h
#include<iostream>using namespace std;class Date
{
public:Date(int year = 1, int month = 1, int day = 1);void Print();bool operator<(const Date& d);bool operator==(const Date& d);private:int _year;int _month;int _day;
};Date.cpp
#include"Date.h"Date::Date(int year, int month , int day)
{_year = year;_month = month;_day = day;
}void Date::Print()
{cout << _year << "-" << _month << "-" << _day << endl;
}bool Date::operator<(const Date& d)
{if (_year < d._year){return true;}else if (_year == d._year && _month < d._month){return true;}else if (_year == d._year && _month == d._month && _day < d._day){return true;}return false;
}bool Date::operator==(const Date& d)
{return _year == d._year&& _month == d._month&& _day == d._day;
}
test.cpp
#include"Date.h"void Test1()
{Date d1(2023, 11, 2);Date d2(2023, 11, 3);cout << (d1 < d2) << endl;cout << (d1 == d2) << endl;
}int main()
{Test1();return 0;
}
当我们实现完前面两个运算符重载以后,剩余的<= >= != >统统可以复用来实现
operator> >= <= !=运算符实现
Date.h
#include<iostream>using namespace std;class Date
{
public:Date(int year = 1, int month = 1, int day = 1);void Print();bool operator<(const Date& d);bool operator==(const Date& d);bool operator>(const Date& d);bool operator!=(const Date& d);bool operator<=(const Date& d);bool operator>=(const Date& d);private:int _year;int _month;int _day;
};Date.cpp
#include"Date.h"Date::Date(int year, int month , int day)
{_year = year;_month = month;_day = day;
}void Date::Print()
{cout << _year << "-" << _month << "-" << _day << endl;
}bool Date::operator<(const Date& d)
{if (_year < d._year){return true;}else if (_year == d._year && _month < d._month){return true;}else if (_year == d._year && _month == d._month && _day < d._day){return true;}return false;
}bool Date::operator==(const Date& d)
{return _year == d._year&& _month == d._month&& _day == d._day;
}bool Date::operator>(const Date& d)
{return !(*this < d);
}
bool Date::operator!=(const Date& d)
{return !(*this == d);
}
bool Date::operator<=(const Date& d)
{return *this < d || *this == d;
}
bool Date::operator>=(const Date& d)
{return !(*this < d) || *this == d;
}test.cpp
#include"Date.h"void Test1()
{Date d1(2023, 11, 2);Date d2(2023, 11, 3);cout << (d1 < d2) << endl;cout << (d1 == d2) << endl;cout << (d1 > d2) << endl;cout << (d1 != d2) << endl;cout << (d1 <= d2) << endl;cout << (d1 >= d2) << endl;
}int main()
{Test1();return 0;
}
因为类成员作为函数成员重载时,第一个默认的形参为隐含的Date*const this指针,因此实现完两个运算符重载函数后,直接复用即可,简洁且高效。
日期类除了比较大小有意思之外 那么日期的相减 相加同样也有意义
那么在计算日期相减 相加 就需要知道某个月 包含的天数 某年是否为闰年
这个时候就需要我们的Getmonthday函数的定义
Getmonthday函数实现
Date.cpp
int Date::Getmonthday(int year, int month)
{assert(year >= 1 && month >= 1 && month <= 12);int arry[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };//判断年是否是闰年if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))){return 29;}return arry[month];
}
可以完美帮我们判断闰年 和所对应年 月的天数 方便正确计算 日期的相减相加
也不排除有人会在定义对象的时候给了2023 13 29 月和天显然是不合理的 因此我们需要在成员变量在初始化定义(构造函数)的时候 判断下赋的值正不正确
初始化对象后的判断日期类是否正确
Date.cpp
Date::Date(int year, int month , int day)
{_year = year;_month = month;_day = day;if (_year < 1 || _month < 1 || _month>12|| _day < 1 || _day>Getmonthday(_year, _month)){cout << "非法日期" << endl;Print();}
}test.cppvoid Test1()
{Date d1(2023, 11, 2);Date d2(2023, 13, 3);}int main()
{Test1();return 0;
}
operator+=运算符实现
d1+=50
Date.cpp
Date& Date::operator+=(int day)
{_day += day;while (_day > Getmonthday(_year, _month)){_day -= Getmonthday(_year, _month);++_month;if (_month == 13){++_year;_month = 1;}}return *this;
}test.cpp
void Test2()
{Date d1(2023, 11, 2);d1 += 50;d1.Print();}
我们怎么知道最后结果是正确的呢?去网上搜日期计算器就可以了。
先进行天数的相加,再判断天数是否大于Getmonthday函数里面月天数的大小,如果大于就先进行当前月天数的相减 然后再++月,再判断月的条件,因为返回类型为Date,出了作用域还在,因此用引用返回。
d1+50也有意义
operator+运算符实现
Date.cpp
Date Date::operator+(int day)
{Date tmp(*this);tmp += day;return tmp;}test.cpp
void Test2()
{Date d1(2023, 11, 2);/*d1 += 50;*/d1.Print();Date ret = d1 + 50;ret.Print();}
直接复用+=即可,因为是d1+50 d1本身不改变 先创建一个临时变量 用拷贝构造传this最初的值,再复用+=加上天数 返回tmp临时变量 因为tmp出了作用域不存在 固不用引用返回。
反观上面+=和+的运算符重载实现,-=和-的实现方法也类似
operator-=运算符实现
Date.cpp
Date& Date::operator-=(int day)
{_day -= day;while (_day <= 0){--_month;if (_month == 0){--_year;_month = 12;}_day += Getmonthday(_year, _month);}return *this;
}test.cpp
void Test2()
{Date d1(2023, 11, 2);/*d1 += 50;*/d1 -= 50;d1.Print();/*d1.Print();Date ret = d1 + 50;ret.Print();*/}
operator-运算符实现
Date.cpp
Date Date::operator-(int day)
{Date tmp(*this);tmp -= day;return tmp;
}test.cpp
void Test2()
{Date d1(2023, 11, 2);/*d1 += 50;*//*d1 -= 50;d1.Print();*//*d1.Print();Date ret = d1 + 50;ret.Print();*/Date ret = d1 - 50;d1.Print();ret.Print();}
那么C语言有前置++和后置++ 那么运算符重载自定义对象时怎么分辨呢?
C++之父为了区分前置++和后置++ 在后面++后面加了个int形参
d1++ ++d1 也有意义
operator++(前置)运算符实现
Date.cpp
Date& Date:: operator++()
{*this += 1;return*this;
}test.cpp
void Test2()
{Date d1(2023, 11, 2);/*d1 += 50;*//*d1 -= 50;d1.Print();*//*d1.Print();Date ret = d1 + 50;ret.Print();*//*Date ret = d1 - 50;d1.Print();ret.Print();*/++d1;d1.Print();++d1;d1.Print();}
因为前置++自己本身也会跟着随之改变 所以引用返回this本身。
operator++(后置)运算符实现
Date.cpp
Date Date::operator++(int)
{Date tmp(*this);*this += 1;return tmp;
}test.cpp
void Test3()
{Date d1(2023, 11, 2);d1.Print();d1++;d1.Print();
}
operator--(前置)运算符实现
Date.cpp
Date& Date::operator--()
{*this -= 1;return *this;
}test.cpp
void Test3()
{Date d1(2023, 11, 2);/*d1.Print();d1++;d1.Print();*/--d1;d1.Print();--d1;d1.Print();
}
operator--(后置)运算符实现
Date.cpp
Date Date::operator--(int)
{Date tmp(*this);*this -= 1;return tmp;
}test.cpp
void Test3()
{Date d1(2023, 11, 2);/*d1.Print();d1++;d1.Print();*//*--d1;d1.Print();--d1;d1.Print();*/d1.Print();d1--;d1.Print();}
既然日期-天数 日期-月 日期++都有意义 那么日期-日期也有意义
比如计算2023到2024年还有多少天
operator-(日期-日期)
Date.cpp
int Date::operator-(const Date& d)
{// 假设左大右小int flag = 1;Date max = *this; //this指向d1Date min = d; //d2// 假设错了,左小右大if (*this < d){max = d;min = *this;flag = -1;}int n = 0;while (min != max){++min;++n;}return n * flag;
}test.cpp
void Test4()
{Date d1(2023, 11, 2);Date d2(2024, 1, 1);cout << (d1 - d2) << endl;
}
但我们在+= 和-=忽略掉了一个问题 就是当给天数 给成负值怎么办?比如d1+=(-50) d1+(-50)
当我们用我们上面实现的+=时
d1+=50 d1=d1+(-50) d1=2-50=-48
void Test4()
{Date d1(2023, 11, 2);//Date d2(2024, 1, 1);d1 += -50;d1.Print();//cout << (d1 - d2) << endl;
}
天数变成了负值 但那个日期计算器人家是能正常计算的
为了能够正确计算负天数,我们只需要加个一个判断条件即可
当天数小于0时 d1+=-50 变成了 d1=d1-(-50) 即d1+=50 d1=d1+50;
Date& Date::operator+=(int day)
{if (day < 0){return *this -= (-day);}_day += day;while (_day > Getmonthday(_year, _month)){_day -= Getmonthday(_year, _month);++_month;if (_month == 13){++_year;_month = 1;}}return *this;
}
-=也一样加上判断条件即可
Date& Date::operator-=(int day)
{if (day < 0){return *this += (-day);}_day -= day;while (_day <= 0){--_month;if (_month == 0){--_year;_month = 12;}_day += Getmonthday(_year, _month);}
日期类实现全部代码
Date.h
#include<iostream>
#include<assert.h>
using namespace std;class Date
{
public:Date(int year = 1, int month = 1, int day = 1);void Print();int Getmonthday(int year, int month);bool operator<(const Date& d)const;bool operator==(const Date& d)const;bool operator>(const Date& d)const;bool operator!=(const Date& d)const;bool operator<=(const Date& d)const;bool operator>=(const Date& d)const;Date& operator+=(int day);Date operator+(int day)const;Date& operator-=(int day);Date operator-(int day)const;Date& operator++();Date operator++(int);Date& operator--();Date operator--(int);int operator-(const Date& d)const;private:int _year;int _month;int _day;
};
Date.cpp
#include"Date.h"Date::Date(int year, int month , int day)
{_year = year;_month = month;_day = day;if (_year < 1 || _month < 1 || _month>12|| _day < 1 || _day>Getmonthday(_year, _month)){cout << "非法日期" << endl;Print();}
}void Date::Print()const
{cout << _year << "_" << _month << "_" << _day << endl;
}bool Date::operator<(const Date& d)const
{if (_year < d._year){return true;}else if (_year == d._year && _month < d._month){return true;}else if (_year == d._year && _month == d._month && _day < d._day){return true;}return false;
}bool Date::operator==(const Date& d)const
{return _year == d._year&& _month == d._month&& _day == d._day;
}bool Date::operator>(const Date& d)const
{return !(*this < d);
}
bool Date::operator!=(const Date& d)const
{return !(*this == d);
}
bool Date::operator<=(const Date& d)const
{return *this < d || *this == d;
}
bool Date::operator>=(const Date& d)const
{return !(*this < d) || *this == d;
}
int Date::Getmonthday(int year, int month)
{assert(year >= 1 && month >= 1 && month <= 12);int arry[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };//判断年是否是闰年if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))){return 29;}return arry[month];
}
Date& Date::operator+=(int day)
{if (day < 0){return *this -= (-day);}_day += day;while (_day > Getmonthday(_year, _month)){_day -= Getmonthday(_year, _month);++_month;if (_month == 13){++_year;_month = 1;}}return *this;
}Date Date::operator+(int day)const
{Date tmp(*this);tmp += day;return tmp;}Date& Date::operator-=(int day)
{if (day < 0){return *this += (-day);}_day -= day;while (_day <= 0){--_month;if (_month == 0){--_year;_month = 12;}_day += Getmonthday(_year, _month);}return *this;
}
Date Date::operator-(int day)const
{Date tmp(*this);tmp -= day;return tmp;
}
Date& Date:: operator++()
{*this += 1;return*this;
}Date Date::operator++(int)
{Date tmp(*this);*this += 1;return tmp;
}Date& Date::operator--()
{*this -= 1;return *this;
}
Date Date::operator--(int)
{Date tmp(*this);*this -= 1;return tmp;
}int Date::operator-(const Date& d)const
{// 假设左大右小int flag = 1;Date max = *this; //this指向d1Date min = d; //d2// 假设错了,左小右大if (*this < d){max = d;min = *this;flag = -1;}int n = 0;while (min != max){++min;++n;}return n * flag;
}
test.cpp
#include"Date.h"//void Test1()
//{
// /*Date d1(2023, 11, 2);
// Date d2(2023, 13, 3);*/
//
// /*cout << (d1 < d2) << endl;
// cout << (d1 == d2) << endl;
// cout << (d1 > d2) << endl;
// cout << (d1 != d2) << endl;
// cout << (d1 <= d2) << endl;
// cout << (d1 >= d2) << endl;*/
//}//void Test2()
//{
// Date d1(2023, 11, 2);
// /*d1 += 50;*/
// /*d1 -= 50;
// d1.Print();*/
// /*d1.Print();
// Date ret = d1 + 50;
// ret.Print();*/
// /*Date ret = d1 - 50;
// d1.Print();
// ret.Print();*/
// /*++d1;
// d1.Print();
// ++d1;
// d1.Print();*/
//
//}//void Test3()
//{
// Date d1(2023, 11, 2);
// /*d1.Print();
// d1++;
// d1.Print();*/
//
// /*--d1;
// d1.Print();
// --d1;
// d1.Print();*/
// d1.Print();
// d1--;
// d1.Print();
//
//}
void Test4()
{Date d1(2023, 11, 2);//Date d2(2024, 1, 1);d1 += -50;d1.Print();//cout << (d1 - d2) << endl;
}
int main()
{//Test1();//Test2();//Test3();Test4();return 0;
}
const成员
加上const后为什么不能打印出来呢?因为这里是权限的放大
从const Date*const this变成了 Date*const this 形成了权限的放大
那怎么解决呢?祖师爷决定在括号加上一个const(声明和定义后面都要加上)
当加个const以后 const就修饰了Date*const this变成了const Date*const this const本质是修饰this
从权限的放大变成了权限的平移 就能打印了
那么非const对象能调用const函数吗 ?
答案是可以的,因为Date*const this 变成了 const Date*const this 形成了权限的缩小
权限可以平移和缩小 但不能放大。
那么所有函数都能定义成const函数吗?是不可以的,当需要修改成员变量的成员函数,不能改成const。
但能定义成const的成员函数都应该定义成const
这样const对象和非const对象都可以调用(const权限的平移和const权限的缩小)
要修改成员变量的成员函数,不能定义成const
因此在日期类成员函数在不修改成员变量的成员函数后面都可以加上const
取地址及const取地址操作符重载

当屏蔽掉非const取地址操作函数,非const会去调用const取地址操作函数
这两个取地址操作符重载一般使用编译器默认生成的就可以。
只有特殊情况,才需要重载,比如想让别人获取到指定的内容!
不想让别人获取地址可以返回空指针nullptr或者返回自己编造的一个地址。
operator实现<<流插入
为什么不能打印出d1内容,因为<<不识别自定义类型对象 为什么可以识别内置类型呢?
因为C++已经头文件里面的库函数已经帮忙实现了
为了实现识别自定义类型对象,自己照猫画虎实现一个即可。
Date.h 声明
Date.cpp 定义
但是它有一个问题,就是访问不了私有成员变量,我们暂且先取消掉private,把成员变量放开
但出现了问题 cout<<d1打印不了 d1<<cout可以打印,这又是为什么呢?
因为双目操作数的运算符,规定第一个参数必须是左操作数(*this),第二个参数必须是右操作数
d1<<cout 转换 d1.operator<<(&d1,cout); cout<<d1 第一个参数是cout 第二个是*this所以不行。
那么为了规定传参,流插入的实现只能在全局进行实现,因为成员函数Date对象默认占据第一个位置。
在全局实现又有两个问题,第一个不能访问私有成员变量,第二个不能支持连续插入
我们给流插入返回值就能解决连续cout的问题
那么访问不了私有成员变量怎么解决呢?这时候就要用到我们的友元函数
友元函数就是在类里面成员函数 前面加个friend 表面是友元函数 我和你是好朋友,可以去你家里玩私有物品,比如游戏机 上厕所等。
那么流提取的实现与流插入相仿
operator实现>>流提取
流本质是为了解决,自定义类型的输入和输出问题
printf scanf 无法解决自定义类型的输入输出问题面向对象 + 运算符重载解决.
相关文章:

C++——类和对象(中)完结
赋值运算符重载 运算符重载 C 为了增强代码的可读性引入了运算符重载 , 运算符重载是具有特殊函数名的函数 ,也具有其 返回值类型,函数名字以及参数列表,其返回值类型与参数列表与普通的函数类似。 函数名字为:关键…...

Sqoop的安装和使用
目录 一.安装 二.导入 1.全量导入 一.MySQL导入HDFS 二.MySQL导入Hive 2.增量导入 一.过滤导入hdfs/hive 二.导出 一.安装 1.下载地址:sqoop下载地址 2.解压 tar -zxvf ./sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz -C ../module/ 3.改名和配置归属权限 #改名…...

java毕业设计基于springboot+vue的村委会管理系统
项目介绍 采用JAVA语言,结合SpringBoot框架与Vue框架以及MYSQL数据库设计并实现的。本村委会管理系统主要包括个人中心、村民管理、村委会管理、村民信息管理、土地变更管理、农业补贴管理、党员信息管理等多个模块。它帮助村委会管理实现了信息化、网络化…...

【C++】多态 ⑪ ( 纯虚函数和抽象类 | 纯虚函数语法 | 抽象类和实现 | 代码示例 )
文章目录 一、纯虚函数和抽象类1、纯虚函数2、纯虚函数语法3、抽象类和实现 二、完整代码示例 一、纯虚函数和抽象类 1、纯虚函数 纯虚函数 : 在 C 语言中 , " 纯虚函数 " 是 特殊类型的 虚函数 , " 纯虚函数 " 在 父类 中 声明 , 但是没有实现 ; 抽象类 …...
node 第十四天 基于express的第三方中间件multer node后端处理用户上传文件
Multer 是一个 node.js 中间件,用于处理multipart/form-data 类型的表单数据,它主要用于上传文件。它是写在 busboy 之上的所以非常高效。前面我们已经知道了怎样利用express提供的静态资源处理中间件express.static()处理用户请求静态资源文件(图片, js…...

KnowledgeGPT:利用检索和存储访问知识库上增强大型语言模型10.30
利用检索和存储访问知识库上增强大型语言模型 摘要引言2 相关研究3方法3.1 任务定义3.2 知识检索3.2.1 代码实现3.2.2 实体链接3.2.3 获取实体信息3.2.4 查找实体或值3.2.5 查找关系 3.3 知识存储 4 实验4.1 实验设置4.2 流行知识库上的查询4.3 基于知识的问题回答 摘要 大型语…...
Angular material Chips Autocomplete
Chips Autocomplete 官网的例子我没法正常使用,无法实现搜索 我的select是个通用组件,现在贴代码: component.ts import {Component,ElementRef,forwardRef,Input,OnChanges,OnDestroy,OnInit,SimpleChanges,ViewChild, } from angular/co…...

『亚马逊云科技产品测评』活动征文|搭建基础运维环境
授权声明:本篇文章授权活动官方亚马逊云科技文章转发、改写权,包括不限于在 Developer Centre, 知乎,自媒体平台,第三方开发者媒体等亚马逊云科技官方渠道 目录 1、什么是容器化部署 2、连接到控制台 3、安装docker 3.1 更新…...
双指针扫描
import os import sys# 请在此输入您的代码 sinput() Alist(s) nlen(A) t1 for i in range(n//2):if A[i]!A[n-1-i]:t0break if t1:print(Y) else:print(N)n,smap(int,input().split()) alist(map(int,input().split())) #尺取法,变O(n*n)为O(n) #维护一个最短的区间…...

uniapp小程序九宫格抽奖
定义好奖品下标,计时器开始抽奖,请求接口,出现中奖奖品之后,获取中奖商品对应的奖品下标,再次计时器判断当前移动的小标是否为中奖商品的下标,并且是否转到3圈(防止转1圈就停止)&…...
mysql树状结构查询及注意事项
一、说明 由于Mysql不像oracle一样支持树状查询,需要用户自行处理,本文记录了一种常见的通过自定义函数的方式进行mysql树状查询的方法,以及使用的注意事项。 二、函数 CREATE DEFINERrootlocalhost FUNCTION get_child_menus(in_pid varc…...

TimeGPT-1——第一个时间序列数据领域的大模型他来了
一直有一个问题:时间序列的基础模型能像自然语言处理那样存在吗?一个预先训练了大量时间序列数据的大型模型,是否有可能在未见过的数据上产生准确的预测?最近刚刚发表的一篇论文,Azul Garza和Max Mergenthaler-Canseco提出的TimeGPT-1,将ll…...

通过Google搜索广告传送的携带木马的PyCharm软件版本
导语 最近,一起新的恶意广告活动被发现,利用被入侵的网站通过Google搜索结果推广虚假版本的PyCharm软件。这个活动利用了动态搜索广告,将广告链接指向被黑客篡改的网页,用户点击链接后下载的并不是PyCharm软件,而是多种…...

网站文章收录因素,别人复制文章排名比你原创的好?
我经常看到有站长抱怨“网站不收录”,“排名不好”,“复制的文章为什么秒收”之类的问题。对于SEO从业者来说,这确实是一个打击,认为搜索引擎不公平。凭什么自己原创不收录,别人复制去了,秒收他的ÿ…...

C#开源的一个能利用Windows通知栏背单词的软件 - ToastFish
前言 今天给大家推荐一个C#开源且免费的能利用Windows通知栏背单词的软件,可以让你在上班、上课等恶劣环境下安全隐蔽地背单词(利用摸鱼时间背单词的软件):ToastFish。 操作系统要求 目前该软件只支持Windows10及以上系统&…...

速拿offer,超全自动化测试面试题+答案汇总,背完还怕拿不到offer?
目录:导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结(尾部小惊喜) 前言 1、你会封装自动化…...
LeetCode----1415. 长度为 n 的开心字符串中字典序第 k 小的字符串
题目 一个 「开心字符串」定义为: 仅包含小写字母 [‘a’, ‘b’, ‘c’].对所有在 1 到 s.length - 1 之间的 i ,满足 s[i] != s[i + 1] (字符串的下标从 1 开始)。比方说,字符串 “abc”,“ac”,“b” 和 “abcbabcbcb” 都是开心字符串,但是 “aa”,“baa” 和 “a…...
2310C++协程超传服务器
原文 告别异步回调模型,写代码更简单.同样也是跨平台,仅头文件的,包含头文件即可用,来看看它的用法. 基本用法 提供getpost服务 coro_http_server server(1, 9001);server.set_http_handler<GET, POST>("/", [](coro_http_request &req, coro_http_respo…...

【排序算法】 计数排序(非比较排序)详解!了解哈希思想!
🎥 屿小夏 : 个人主页 🔥个人专栏 : 算法—排序篇 🌄 莫道桑榆晚,为霞尚满天! 文章目录 📑前言🌤️计数排序的概念☁️什么是计数排序?☁️计数排序思想⭐绝对…...

20231103配置cv180zb的编译环境【填坑篇】
20231103配置cv180zb的编译环境【填坑篇】 2023/11/3 11:36 感谢您选择了晶视科技的cv180zb,让我们一起来填坑。 在你根据文档找不到答案的时候,是不是想把他们家那个写文档的家伙打一顿,我顶你。 当你在在网上找一圈,BAIDU/BING/…...
[2025CVPR]DeepVideo-R1:基于难度感知回归GRPO的视频强化微调框架详解
突破视频大语言模型推理瓶颈,在多个视频基准上实现SOTA性能 一、核心问题与创新亮点 1.1 GRPO在视频任务中的两大挑战 安全措施依赖问题 GRPO使用min和clip函数限制策略更新幅度,导致: 梯度抑制:当新旧策略差异过大时梯度消失收敛困难:策略无法充分优化# 传统GRPO的梯…...

日语AI面试高效通关秘籍:专业解读与青柚面试智能助攻
在如今就业市场竞争日益激烈的背景下,越来越多的求职者将目光投向了日本及中日双语岗位。但是,一场日语面试往往让许多人感到步履维艰。你是否也曾因为面试官抛出的“刁钻问题”而心生畏惧?面对生疏的日语交流环境,即便提前恶补了…...

Xshell远程连接Kali(默认 | 私钥)Note版
前言:xshell远程连接,私钥连接和常规默认连接 任务一 开启ssh服务 service ssh status //查看ssh服务状态 service ssh start //开启ssh服务 update-rc.d ssh enable //开启自启动ssh服务 任务二 修改配置文件 vi /etc/ssh/ssh_config //第一…...
Robots.txt 文件
什么是robots.txt? robots.txt 是一个位于网站根目录下的文本文件(如:https://example.com/robots.txt),它用于指导网络爬虫(如搜索引擎的蜘蛛程序)如何抓取该网站的内容。这个文件遵循 Robots…...
Spring AI与Spring Modulith核心技术解析
Spring AI核心架构解析 Spring AI(https://spring.io/projects/spring-ai)作为Spring生态中的AI集成框架,其核心设计理念是通过模块化架构降低AI应用的开发复杂度。与Python生态中的LangChain/LlamaIndex等工具类似,但特别为多语…...

使用 Streamlit 构建支持主流大模型与 Ollama 的轻量级统一平台
🎯 使用 Streamlit 构建支持主流大模型与 Ollama 的轻量级统一平台 📌 项目背景 随着大语言模型(LLM)的广泛应用,开发者常面临多个挑战: 各大模型(OpenAI、Claude、Gemini、Ollama)接口风格不统一;缺乏一个统一平台进行模型调用与测试;本地模型 Ollama 的集成与前…...

python执行测试用例,allure报乱码且未成功生成报告
allure执行测试用例时显示乱码:‘allure’ �����ڲ����ⲿ���Ҳ���ǿ�&am…...
服务器--宝塔命令
一、宝塔面板安装命令 ⚠️ 必须使用 root 用户 或 sudo 权限执行! sudo su - 1. CentOS 系统: yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh2. Ubuntu / Debian 系统…...

安宝特案例丨Vuzix AR智能眼镜集成专业软件,助力卢森堡医院药房转型,赢得辉瑞创新奖
在Vuzix M400 AR智能眼镜的助力下,卢森堡罗伯特舒曼医院(the Robert Schuman Hospitals, HRS)凭借在无菌制剂生产流程中引入增强现实技术(AR)创新项目,荣获了2024年6月7日由卢森堡医院药剂师协会࿰…...

【JVM面试篇】高频八股汇总——类加载和类加载器
目录 1. 讲一下类加载过程? 2. Java创建对象的过程? 3. 对象的生命周期? 4. 类加载器有哪些? 5. 双亲委派模型的作用(好处)? 6. 讲一下类的加载和双亲委派原则? 7. 双亲委派模…...