<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[mathilda33的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/mathilda33</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; mathilda33]]></copyright><item><title><![CDATA[【c++】重载运算符｜赋值运算符]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/106205885</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/106205885</guid><author>mathilda33</author><pubDate>Tue, 19 May 2020 05:14:30 +0800</pubDate><description><![CDATA[运算符重载
• 对已有的运算符赋予多重的含义
• 使同一运算符作用于不同类型的数据时 -&gt; 不同类型的行为
• 运算符重载的实质是函数重载
运算符重载为普通函数
重载为普通函数时, 参数个数为运算符目数
class Complex {
	public:
	Complex( double r = 0.0, double i= 0.0 ){
 		real = r;
 		imaginary = i;
	}
	double real; // real part
	double imaginary; // ]]></description><category></category></item><item><title><![CDATA[【c++】友元｜this指针｜常量对象/成员函数和常引用]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/106172465</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/106172465</guid><author>mathilda33</author><pubDate>Mon, 18 May 2020 03:34:59 +0800</pubDate><description><![CDATA[友元函数
一个类的友元函数可以访问该类的私有成员
class CCar; //提前声明 CCar类, 以便后面CDriver类使用
class CDriver {
	public:
 	void ModifyCar( CCar * pCar) ; //改装汽车
};
class CCar {
 	private:
 	int price;
 	friend int MostExpensiveCar( CCar cars[], int total); //声明友元
 	friend void CDriver:]]></description><category></category></item><item><title><![CDATA[【c++】静态成员变量和静态成员函数｜成员对象和封闭类]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/106169358</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/106169358</guid><author>mathilda33</author><pubDate>Sun, 17 May 2020 12:14:30 +0800</pubDate><description><![CDATA[静态成员变量和静态成员函数
在说明前面加了static关键字的成员。
普通成员变量每个对象有各自的一份，而静态成员变量一共就一份，为所有对象共享。
sizeof运算符不会计算静态成员变量。
普通成员函数必须具体作用于某个对象，而静态成员函数并不具体作用于某个对象。
静态成员不需要通过对象就能访问。
如何访问静态成员：
1）类名::成员名
CRectangle::PrintTotal();
2）对象名.成员名
CRectangle r; r.PrintTotal();
3）指针-&gt;成员名
CRectan]]></description><category></category></item><item><title><![CDATA[【c++】复制构造函数｜类型转换构造函数｜析构函数]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/106169014</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/106169014</guid><author>mathilda33</author><pubDate>Sun, 17 May 2020 05:37:25 +0800</pubDate><description><![CDATA[复制构造函数
只有一个参数，即完成对同类对象的引用
形如X::X( X&amp; )或X::X(const X &amp;)，二者选一，后者能一常量对象作为参数
如果没有定义复制构造函数，那么编译器生成默认复制构造函数。默认的复制构造函数完成复制功能。
class Complex{
	private:
		double real, imag;
};
Complex c1;//调用缺省无参构造函数
Complex c2(c1);//调用缺省的复制构造函数，将c2初始化成hec1一样

如果定义的自己的复制构造]]></description><category></category></item><item><title><![CDATA[【c++】内联成员函数和重载成员函数｜构造函数]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/106168526</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/106168526</guid><author>mathilda33</author><pubDate>Sun, 17 May 2020 03:34:38 +0800</pubDate><description><![CDATA[内联成员函数

inline+成员函数
整个函数体出现在类定义内部

class B{
	//inline+成员函数
	inline void func1();
	//整个函数体出现在类定义内部
	void func2(){
	};
};
void B::func1(){}

成员函数的重载以及参数缺省
重载成员函数
成员函数带缺省参数
class Location{
	private:
		int x, y;
	public:
		void init(int x = 0, int y = 0);
		vo]]></description><category></category></item><item><title><![CDATA[【c++】对象类]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/106157368</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/106157368</guid><author>mathilda33</author><pubDate>Sat, 16 May 2020 12:52:06 +0800</pubDate><description><![CDATA[对象的内存空间：
对象的大小=所有成员变量的大小之和
eg：
class CRectangle{
	public:
		int w, h;
	void Init(int w_, int h_){
		w = w_; h = h_;
	}
	int Area(){
		return w * h;
	}
	int Perimeter(){
		return 2*(w + h);
	}
};//必须要有分号

CRectangle类的对象，sizeof(CRectangle) = 8（两个int）
每个对象各自有]]></description><category></category></item><item><title><![CDATA[【c++】动态内存分配 ｜ 内联函数和函数重载 ｜函数的缺省参数]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/106153705</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/106153705</guid><author>mathilda33</author><pubDate>Sat, 16 May 2020 08:32:21 +0800</pubDate><description><![CDATA[用new运算符实现动态内存分配
需要多少空间就分配多少
第一种方法，分配一个变量：P = new T
p是类型为T *的指针，T是任意类型名。
动态分配出一片大小为sizeof(T)字节的内存空间，并且将该内存空间的起始地址赋值给P
int *pn;
pn = new int;
*pn = 5;//往新分配出来的存储空间里写了个5

第二种方法，分配一个数组：P = new T[N]
p是类型为T 的指针，T是任意类型名，N要分配的数组元素个数，可以是整型表达式。
动态分配出一片大小为Nsizeof(T)字]]></description><category></category></item><item><title><![CDATA[【c++】位运算 ｜ 引用 ｜ 常引用 ｜ cost关键字和常量]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/106153388</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/106153388</guid><author>mathilda33</author><pubDate>Sat, 16 May 2020 07:43:27 +0800</pubDate><description><![CDATA[位运算：
特点：速度非常快，如果能在程序中合理使用将大大提高程序运行速度
&amp; 与：只有两个都是1才是1，否则为0
可以把某些位清0且同时保留其他位不变，也可以用来获取某变量中的一位。
eg：
将int型低8位全置成0，其余位不变：
n = n &amp; 0xffffff00 或者n &amp;=  0xffffff00
如果n是short类型：
n &amp;= 0xff00
如何判断一个int型变量n的第7位（从右往左，0开始数）是否为1？
n&amp; 0x80 == 0x80
0x80 = ]]></description><category></category></item><item><title><![CDATA[【c++】函数指针和qsort库函数]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/106153376</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/106153376</guid><author>mathilda33</author><pubDate>Sat, 16 May 2020 05:46:52 +0800</pubDate><description><![CDATA[在C语言或者C++语言中可以把一个函数的入口地址赋值给一个指针，这就叫函数指针，然后可通过函数指针来调用函数。
C语言中：
定义形式：类型名（*指针变量名）（参数类型1，参数类型2…）
eg: int(*pf)(int,char)
表示pf是一个函数指针，它所指向的函数，返回值是int，有两个参数，分别为int和char
#include&lt;stdio.h&gt;
void PrintMin(int a, int b){
	if(a&lt;b)
		print("%d", a);
	else
		pri]]></description><category></category></item><item><title><![CDATA[【python】用zip+sorted将一个list按照另一个list的顺序排序]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/105139668</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/105139668</guid><author>mathilda33</author><pubDate>Fri, 27 Mar 2020 13:51:34 +0800</pubDate><description><![CDATA[之前在网上查查到了是利用zip+sorted
后面更深入的研究了一下
a = [1, 1, 1, 2, 2, 2, 3, 3, 3]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9]
a, b = zip(*sorted(zip(a, b)))

其实是这样比较的，先按照第一个list排大小，如果第一个list中元素相同再按照第二个list中的元素比较大小，依次类推
下面是一些例子
...]]></description><category></category></item><item><title><![CDATA[Git相关笔记]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/104726803</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/104726803</guid><author>mathilda33</author><pubDate>Sun, 08 Mar 2020 07:48:15 +0800</pubDate><description><![CDATA[1: 创建一个本地 git 存储库
要在文件夹的根目录中初始化 git 仓库，运行 git init 命令:
cd ~/Desktop
mkdir myproject
cd myproject/
git init

2: 向目录中添加一个新文件
继续向项目中添加一个新文件，使用任何文本编辑器或运行 touch 命令。
一旦在一个文件夹中添加或者修改了文件，git 就会注意到在这个文件夹中已经做了修...]]></description><category></category></item><item><title><![CDATA[【python】Function References and Decorator 函数的引用以及操作符@的用法]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/104667166</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/104667166</guid><author>mathilda33</author><pubDate>Thu, 05 Mar 2020 05:23:23 +0800</pubDate><description><![CDATA[@f
def g():
...

f是一个Decorator，这意味着f是一个函数会把引用带入其他函数，并且返回另一个函数的引用
先来看这个函数，每次调用mult_fn都会返回一个新的函数，double triple都是新的函数
def mult_fn(N):
    def multiply(x):
        return x * N
    return multiply

double...]]></description><category></category></item><item><title><![CDATA[【python】Tuples元组]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/104666863</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/104666863</guid><author>mathilda33</author><pubDate>Thu, 05 Mar 2020 02:59:31 +0800</pubDate><description><![CDATA[基本介绍
元组是值的序列。 这些值可以是任何类型，并且它们由整数进行索引，因此在这方面元组非常类似于列表。 重要的区别在于元组是不可变的（immutable）。
在语法上，tuple 是一个以逗号分隔的值列表，虽然没有必要，但常常将元组括在括号内。
t = 'a', 'b', 'c'
type(t)
#tuple
t = ('a', 'b', 'c')
type(t)
#tuple

要用创建一个...]]></description><category></category></item><item><title><![CDATA[【python】Regex相关函数的使用]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/104646639</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/104646639</guid><author>mathilda33</author><pubDate>Wed, 04 Mar 2020 09:27:50 +0800</pubDate><description><![CDATA[re.search
re.search(pattern, string)在字符串的任何位置搜索正则表达式的匹配。 如果找到，则返回一个匹配对象；如果没有，则返回 None。
phone_re = r"[0-9]{3}-[0-9]{3}-[0-9]{4}"
text  = "Call me at 382-384-3840."
match = re.search(phone_re, text)
mat...]]></description><category></category></item><item><title><![CDATA[【python】Regular Expressions正则表达式]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/104646323</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/104646323</guid><author>mathilda33</author><pubDate>Wed, 04 Mar 2020 08:34:02 +0800</pubDate><description><![CDATA[在 Python 中，正则表达式通常以原始字符串的形式存储。 原始(raw)字符串的行为类似于普通的 Python 字符串，没有对反斜杠进行特殊处理。
Regex Syntax
例如，要将字符串 hello \ world 存储在一个普通的 Python 字符串中，我们必须写:
some_string = 'hello \\ world'
print(some_string)#hello \ wo...]]></description><category></category></item><item><title><![CDATA[【python】Inheritance继承]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/104623972</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/104623972</guid><author>mathilda33</author><pubDate>Tue, 03 Mar 2020 03:35:20 +0800</pubDate><description><![CDATA[class NamedAnimal:
    def __init__(self, name):
        self.name = name
    
    def __str__(self):
        return "{} {}".format(type(self).__name__, self.name)

    def __repr__(self):
        ret...]]></description><category></category></item><item><title><![CDATA[【python】Special Methods魔方方法]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/104623916</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/104623916</guid><author>mathilda33</author><pubDate>Tue, 03 Mar 2020 03:02:56 +0800</pubDate><description><![CDATA[__init__
初始化一个对象
__str__
定义直接输出的样子
__repr__
定义打印出来的样子。print(object)
__eq__
定义两个不同的对象是否相等
__lt__
定义一个list的对象如何排序
example
class Dog:
    def __init__(self, name, age):
        self.name = name
        s...]]></description><category></category></item><item><title><![CDATA[【C++】Leetcode Top 100 liked easy part]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/104323039</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/104323039</guid><author>mathilda33</author><pubDate>Sat, 29 Feb 2020 07:03:08 +0800</pubDate><description><![CDATA[Map
map 有 4 种：

map&lt;K，T&gt; 每个键都是唯一的，不允许有重复的键，但可以保存重复的对象，只要它们的键不同。map容器中的元素都是有序的，元素在容器内的顺序是通过比较键确定的。默认使用 less 对象比较。
multimap&lt;K，T&gt; 容器和 map&lt;K，T&gt; 容器类似，也会对元素排序。它的键必须是可比较的，元素的顺序是通过比较键确定的。和ma...]]></description><category></category></item><item><title><![CDATA[【python】LIST]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/104422009</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/104422009</guid><author>mathilda33</author><pubDate>Fri, 21 Feb 2020 09:34:07 +0800</pubDate><description><![CDATA[1. list方法总结


list.append(x)
在list的最后增加一个元素，与a[len(a):] = [x]相同


list.extend(L)
在list的最后增加另一个list的所有元素，与a[len(a):] = L相同


a = [1, 2, 3]
b = [4, 5, 6]

a.append(b)
#[1, 2, 3, [4, 5, 6]]

a.extend(b)
...]]></description><category></category></item><item><title><![CDATA[【python】Leetcode记录--02/10-14/2020]]></title><link>https://blog.youkuaiyun.com/mathilda33/article/details/104261119</link><guid>https://blog.youkuaiyun.com/mathilda33/article/details/104261119</guid><author>mathilda33</author><pubDate>Sat, 15 Feb 2020 05:43:21 +0800</pubDate><description><![CDATA[Path Sum III

141. Linked List Cycle
try… except…
try:
&lt;语句&gt;        #运行别的代码
except &lt;名字&gt;：
&lt;语句&gt;        #如果在try部份引发了'name'异常
except &lt;名字&gt;，&lt;数据&gt;:
&lt;语句&gt;        #如果引发了'name'...]]></description><category></category></item></channel></rss>