<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[River_Lethe的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/River_Lethe</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; River_Lethe]]></copyright><item><title><![CDATA[Unity Manual 【翻译】—— 理解自动内存管理]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/80968665</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/80968665</guid><author>River_Lethe</author><pubDate>Mon, 09 Jul 2018 13:24:17 +0800</pubDate><description><![CDATA[原文地址： Understanding Automatic Memory Management



本文翻译自Unity Manual 的 Understanding Automatic Memory Management 一节，主要介绍Unity中的内存管理、垃圾回收，及优化的做法。本文以翻译原文+注解的方式书写。





理解自动内存管理

当创建对象、字符串或数组时，存储它所需的内存将从...]]></description><category></category></item><item><title><![CDATA[Unity Shader 后处理动态效果 —— 油漆流动效果]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/80936936</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/80936936</guid><author>River_Lethe</author><pubDate>Fri, 06 Jul 2018 10:59:05 +0800</pubDate><description><![CDATA[效果如下 


最近在游戏公司实习，终于真正的接触到游戏开发也算是肥宅圆梦了（#大雾），而这个看起来很奇怪的效果就是项目中的一个需求。大致说一下现在参与开发的游戏项目吧，项目是一个FPS手游，不同的是发射出去的“子弹”是类似油漆样的颜料，会在地图上涂上颜色，这个屏幕特效就是用来实现玩家被敌方颜料击中时的屏幕效果。

之前项目对于这个需求的实现方式是采用一个面片播放帧动画，然后遮挡在屏幕前，当时的效...]]></description><category></category></item><item><title><![CDATA[PAT A1044 二分查找]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/79150814</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/79150814</guid><author>River_Lethe</author><pubDate>Wed, 24 Jan 2018 14:51:57 +0800</pubDate><description><![CDATA[1044. Shopping in Mars (25) 
题意给出一个序列和一个定值M，要求找出和为M的子串，如果没有这样的子串，那么要求找出和大于M且和最小的子串标准输入
  16 15 
  3 2 1 5 4 6 8 7 16 10 15 11 9 12 14 13 
标准输出
  1-5 
  4-6 
  7-8 
  11-11
思路 
其实这是一个求子列和的问题，不过有一些限制，不必列]]></description><category></category></item><item><title><![CDATA[PAT A1022 搜索与格式化输入]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/79057182</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/79057182</guid><author>River_Lethe</author><pubDate>Sun, 14 Jan 2018 16:05:42 +0800</pubDate><description><![CDATA[PAT A 1022 Digital Library 
A 1022

这题主要涉及两点


数据的组织及搜索
格式化读入数据








数据组织及搜索

这题数据量大（



struct Book
{
    int book_id,published_year;
    string title, author, publisher;
    vectorstring> key_wor]]></description><category></category></item><item><title><![CDATA[OJ 单链表]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/79052834</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/79052834</guid><author>River_Lethe</author><pubDate>Sat, 13 Jan 2018 18:02:39 +0800</pubDate><description><![CDATA[PAT中有关链表的题一般都是用顺序结构来表示，即将链表的节点储存在一个很大的数组中，数组下标就是节点的地址，节点结构中有一个next成员，储存着逻辑上下个节点的下标，用-1来表示空值。

//基本的节点结构
struct Node
{
    //数据
    int data;
    //下个节点的坐标
    int next;
};


考察范围无非增查删改反转这些，有一个方法可以在不破坏]]></description><category></category></item><item><title><![CDATA[OJ 数据结构：树——建树]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/79028839</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/79028839</guid><author>River_Lethe</author><pubDate>Wed, 10 Jan 2018 22:01:58 +0800</pubDate><description><![CDATA[根据题目要求不同，建一颗树有以下几种方式
按给定序列依次插入节点建树 
适用BST
按非叶节点的孩子节点信息建树 
适用一般树
按中序遍历序列+其他一种遍历序列建树 
适用于二叉树
给定序列插入建数
  适用BST
 
如 PAT A 1043实现//这种情况适合使用 双链表 结构
//因此结顶结构定义为
struct Node
{
  int data;
  shared_ptr<Node> le]]></description><category></category></item><item><title><![CDATA[OJ 如何实现一个按输入顺序排列的映射？]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78995063</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78995063</guid><author>River_Lethe</author><pubDate>Sun, 07 Jan 2018 15:25:19 +0800</pubDate><description><![CDATA[考虑这样一种需求： 
输入若干个字符串，记录所有输入的字符串和它们出现的次数，然后按输入的次序输出结果。

输入：


  aaa bbb aaa ccc zxc ccc


输出


  aaa 2 
  bbb 1 
  ccc 2 
  zxc 1


无论map还是unordered_map都是不符合要求的，map会将键值按字典序排列，而unordered_map则是按照键值的hash值，]]></description><category></category></item><item><title><![CDATA[C++ 关联容器]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78985506</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78985506</guid><author>River_Lethe</author><pubDate>Fri, 05 Jan 2018 21:51:06 +0800</pubDate><description><![CDATA[不同于顺序容器，关联容器根据元素的键（key_type）来组织元素。 关联容器有 set 和 map 两类，根据unordered、multi修饰共衍生出8种关联容器。 
一般根据是否有序来划分：



有序关联容器


map
multimap
set
multiset




无序关联容器


unordered_map
unordered_multimap
unordered_set
uno]]></description><category></category></item><item><title><![CDATA[PAT A1040 最长子回文串]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78975860</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78975860</guid><author>River_Lethe</author><pubDate>Thu, 04 Jan 2018 21:52:19 +0800</pubDate><description><![CDATA[回文串

正反看都一样的字符串称作回文串 
有AA，ABA两种形式：


AA 
形如 xxxxAAxxxx
ABA 
形如 XXXXABAxxxx




A1040 Longest Symmetric String

Given a string, you are supposed to output the length of the longest symmetric sub-string]]></description><category></category></item><item><title><![CDATA[PAT A1060字符串处理]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78963556</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78963556</guid><author>River_Lethe</author><pubDate>Wed, 03 Jan 2018 17:25:20 +0800</pubDate><description><![CDATA[处理字符串的实用函数字符串处理是PAT基础题中较难的一种，一般不涉及数据结构的知识，基础但并不容易AC，有很多边界情况要考虑。 使用字符数组的方法处理字符串非常麻烦和琐碎，使用string的函数以及STL一些与字符串有关的函数可以使问题更清晰简单 
string相关函数string str = "hello world~";//#1 str.substr返回子串的拷贝
string s1 = str]]></description><category></category></item><item><title><![CDATA[OJ string的额外操作]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78938742</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78938742</guid><author>River_Lethe</author><pubDate>Sat, 30 Dec 2017 18:43:42 +0800</pubDate><description><![CDATA[string作为一种顺序容器，除了支持insert、assign、erase、push_back、pop_back、取地址符外，还支持构造string的其他方法
string s(cp,n) 
从char*指向的字符数组拷贝n个字符
string s(cp) 
从以’\0’结尾的字符串拷贝整个字符串
string s(s2,pos2,len2) 
从另一个string 的pos2位置拷贝len2个字]]></description><category></category></item><item><title><![CDATA[OJ 简单数学问题]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78929599</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78929599</guid><author>River_Lethe</author><pubDate>Fri, 29 Dec 2017 11:21:48 +0800</pubDate><description><![CDATA[最大公约数gcd和最小公倍数lcm


gcd(greatest common divisor) 
根据欧几里得算法，a、b的最大公约数与b、a%b的最大公约数相同； 
任何数与0的最大公约数为它本身 
因此有




int gcd(int a,int b)
{
    return !b?a:gcd(b,a%b);
}


lcm(lowest common multiple) 
最小公倍数可]]></description><category></category></item><item><title><![CDATA[OJ之格式控制]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78892558</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78892558</guid><author>River_Lethe</author><pubDate>Mon, 25 Dec 2017 14:36:45 +0800</pubDate><description><![CDATA[printf及格式控制符

由于性能及输出格式灵活性的考虑，OJ中更常用printf来输出


基本类型输出说明符 

其他进制输出整型数 
八进制            　　　　　　　％ｏ 
十六进制 　　　　　　％ｘ 
二进制       　　　　   算法实现
格式控制 





sscanf和正则表达式

和c++的stringstream类似，但对于筛选字符更加灵活，可以与string]]></description><category></category></item><item><title><![CDATA[数据窃取——移动操作]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78803042</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78803042</guid><author>River_Lethe</author><pubDate>Thu, 14 Dec 2017 15:19:42 +0800</pubDate><description><![CDATA[右值引用C++11标准中引入了一种新的引用类型——右值引用（rvalue reference），右值引用必须绑定到一个右值上，用&&来获取右值引用。右值左值表示一个对象的身份，如：
  返回左值引用的函数、下标、解引用、前置递增/递减运算符
而右值表示一个对象的值
  返回非引用类型的函数、算数运算符、位运算、逻辑运算符、后置递增/递减运算符
我们看出右值有以下特点
右值没有其他用户 
右值是无名的]]></description><category></category></item><item><title><![CDATA[unique_ptr的使用和陷阱]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78741607</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78741607</guid><author>River_Lethe</author><pubDate>Thu, 07 Dec 2017 15:07:12 +0800</pubDate><description><![CDATA[unique_ptr的使用分配内存与shared_ptr不同，unique_ptr没有定义类似make_shared的操作，因此只可以使用new来分配内存，并且由于unique_ptr不可拷贝和赋值，初始化unique_ptr必须使用直接初始化的方式。unique_ptr<int> up1(new int());    //okay,直接初始化
unique_ptr<int> up2 = new i]]></description><category></category></item><item><title><![CDATA[shared_ptr的使用和陷阱]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78734879</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78734879</guid><author>River_Lethe</author><pubDate>Wed, 06 Dec 2017 20:37:03 +0800</pubDate><description><![CDATA[shared_ptr的使用分配内存
make_shared
//make_shared<int>分配一块int类型大小的内存，并值初始化为100
//返回值是shared_ptr类型，因此可以直接赋值给sp
shared_ptr<int> sp = make_shared<int>(100);
new接受指针参数的只能指针构造函数是explicit的，因此，我们不能将一个内置指针隐式转化为一个只能指]]></description><category></category></item><item><title><![CDATA[动态内存与智能指针]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78733914</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78733914</guid><author>River_Lethe</author><pubDate>Wed, 06 Dec 2017 18:54:45 +0800</pubDate><description><![CDATA[程序中内存分配有以下五种：
栈区 
     存放局部变量、函数参数等，由编译器自动分配，变量离开作用域后自动收回内存，可分配的内存空间较小。
void func(int _a);
int main()
{
    int a = 5;       //局部变量a存放在栈区
    func(a);        //参数值存放在栈区
}
堆区 
     由程序员手动分配与回收，分配内存后生存期直]]></description><category></category></item><item><title><![CDATA[C++ 严格弱序]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78618788</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78618788</guid><author>River_Lethe</author><pubDate>Thu, 23 Nov 2017 20:40:37 +0800</pubDate><description><![CDATA[什么是严格弱序？C++关联容器的有序容器对元素关键字的类型有要求，元素关键字的类型必须定义了严格弱序（stick weak ordering） 
拿内置类型来说，C++都定义了 “<”操作符，这就是一个严格弱序，而“<=”就不是一个严格弱序严格弱序有什么用？对于内置类型我们自然可以有<、>、=来判断两个值的大小关系，而对于自定义的类类型，为它定义三种比较操作符是没有必要的，只用一个严格弱序（这里就用]]></description><category></category></item><item><title><![CDATA[再探迭代器]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78500450</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78500450</guid><author>River_Lethe</author><pubDate>Fri, 10 Nov 2017 15:40:42 +0800</pubDate><description><![CDATA[除了为每个容器定义的迭代器以外，标准库在头文件 iterator 中还定义了额外4种迭代器
  插入迭代器 、 流迭代器 、 反向迭代器 、 移动迭代器
插入迭代器基本介绍插入器是一种迭代器适配器，接受一个容器，生成一个插入迭代器vector<int> vi;
auto it = back_inserter(vi);
//back_inserter是插入器
//it是其生成的对应容器vi的插入器对插]]></description><category></category></item><item><title><![CDATA[谓词与lambda、bind]]></title><link>https://blog.youkuaiyun.com/River_Lethe/article/details/78491750</link><guid>https://blog.youkuaiyun.com/River_Lethe/article/details/78491750</guid><author>River_Lethe</author><pubDate>Thu, 09 Nov 2017 17:07:58 +0800</pubDate><description><![CDATA[谓词（predicate）标准库中定义了一类可以“定制操作”的算法函数，这类函数接收一个参数，这个参数与以往我们所认识的参数不同，它是一个可调用的对象，其返回结果是一个能用作条件的值。 
这个参数就是谓词。 我们通过谓词来定制特定的操作。 
谓词分为一元谓词和二元谓词，表示可调用表达式接收一个还是两个参数。 
谓词的使用例子：bool isShorter(const string &s1,const]]></description><category></category></item></channel></rss>