自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(79)
  • 收藏
  • 关注

原创 对 virtualbox 虚拟机镜像硬盘扩容

文章目录扩大容量大小使扩容生效扩大容量大小VBoxManage.exe modifyhd '/path/to/the/virtual_hard_disk' --resize 'size_in_MB'确保 VBoxManage.exe 再环境变量中找得到, 当然将路径定位到 VBoxmanage.exe 也可以.使扩容生效virtualbox 用 gparted 镜像启动, 加载扩容后...

2019-08-19 20:58:10 454

原创 Fail to LSB:AppArmor

文章目录发生了什么AppArmor怎么解决发生了什么还是虚拟机 ubuntu 启动时的错误, (host win10, virtualbox). 每次都有该错误, 看着有点难受.AppArmor引用 ubuntu 的解释AppArmor is a Linux Security Module implementation of name-based mandatory access con...

2019-08-19 20:47:41 777

原创 Ubuntu: a start job started by dev-disk-by

文章目录发生了什么如何解决如何获取硬盘 uuid发生了什么最近虚拟机启动 ubuntu 非常慢(host win10, virtualbox), 里面有一段错误 a start job started by dev-disk-by (1m30s). 也就是每次启动至少要多等 1m30s. 这肯定不能忍如何解决查资料得知, 这个错误大概率使因为 /etc/fstab 文件的配置有问题. 因为...

2019-08-19 20:33:07 451

原创 Conert a string to lowercase in c++

文章目录Using ranged for loopusing std::for_eachusing std::transformUsing ranged for loopchar toLowerCase(char c){ if (c >= 'A' && c <= 'Z') { return c + 32; } return c;}std::stri...

2019-08-11 19:30:27 521

原创 理解c++11中的static_assert

文章目录是什么?c++11之前的日子#error的问题简单的 static_assert 使用范例static_assert 相较于 #error 的优势使用范围是什么?static_assert简单来说就是在编译时进行断言判断. 如果条件不满足, 编译停止并输出指定错误信息.语法:static_assert(constant_expression, string_literal); ...

2019-08-07 23:25:45 404

原创 auto_ptr vs unique_ptr

auto_ptr and unique_ptrThe new type std::unique_ptr is introduced in c++11, and supposed to be a replacement for std::auto_ptr.But think this, if it is a direct replacement, why give it a new name ...

2019-07-26 23:00:18 174

原创 Call of Overloaded Function is ambiguous

error: Call of Overloaded Function is ambiguous看例子吧#include<iostream>using namespace std;int sum(int a,int b){ return a+b;}int sum(float a, float b){ return a+b;}int main(){ ...

2019-07-26 22:58:21 11750 3

原创 SIGPIPE and EPIPE

SIGPIPE and EPIPESIGPIPE 是如下情况引起的 (这里只是一个例子)grep "pattern" < reallyhugefile | headgrep 有可能会输出上百万行, 但是 head 只需要读取10行就会退出. 一旦 head 将管道的读端关闭, 那么 grep 就会获得 SIGPIPE 信号, 然后被强制退出, 使其节约资源.如果不想自己的程序因为这...

2019-07-20 22:06:17 1338

原创 error: invalid static_cast from type 'xxx*' to type 'yyy*'

文章目录error: invalid static_cast from type 'xxx*' to type 'yyy*'[What good is static_cast?][1]error: invalid static_cast from type ‘xxx*’ to type ‘yyy*’通常来说, static_cast 不适用于不同指针类型之间的转换, 因为它们是完全不同的两个类...

2019-07-20 21:58:08 13142

原创 Decorator Pattern

文章目录Decorator Pattern适用范围Decorator Pattern用图来表示适用范围动态的为单个对象实例添加新特性而不干扰其他对象实例通过子类的方式来实现拓展变得不实际的情况下...

2019-07-14 22:14:26 95

原创 Bridge Pattern

文章目录Bridge Pattern使用范围Bridge Pattern一张图来展示使用范围将接口定义和实现分离接口定义和实现分辨独立扩展用户端对实现端的代码修改无感知对用户端屏蔽实现部分多个对象之间共享实现部分...

2019-07-10 22:20:57 146

原创 In-class Initialization

文章目录Non-static Data Member InitializersISO C++ forbids in-class initialization of non-const static member[Why I can't initialize static data members in class?][1]C++03 9.4.2 Static data membersWhat ar...

2019-07-09 21:28:46 1261

原创 error: expected unqualified-id before 'xxx'

发生了什么看如下代码class A{public: void do() {}};这会引起GCC报错: error: expected unqualified-id before 'do'解释通常 expected unqualified-id before 这个错误通常是因为语法错误引起的, 如上一个语句没有用分毫结尾之类的. 这个也不例外, 原因就是 do是关键字, ...

2019-07-01 20:25:37 59021

原创 error 'xxx' is an inaccessible base of 'yyy'

又发生了什么看如下代码class VisibilityTest{public: virtual void doIt() { std::cout << "Base\n"; }};class DVisibilityTest : private VisibilityTest{private: virtual void doIt() override { st...

2019-07-01 20:24:13 1705

原创 Loki::GenScatterHierarchy

Loki::GenScatterHierarchy阅读Loki泛型库, 用图来展示Loki::GenScatterHierarchytemplate<class T>class Collection{public: std::vector<T> m_vector;};Loki::GenScatterHierarchy<MakeTypelist&...

2019-06-30 22:07:56 177

原创 Abstract Factory Pattern

Abstract Factory Pattern图比语言好使适用范围将对象的创建, 组合和表示方式从系统中独立出来系统需要多种的一类对象相关的对象需要一起的使用, 可以用该方式来进行限制需要对外提供库支持, 但只想暴露接口不想暴露实现...

2019-06-29 23:00:24 150

转载 How to unit test a method that has void as return type

转 How to unit test a method that has void as return typeHow to unit test a method that has void as return typeHow do I test a method that returns void? For example a method like this.void Foo::Proc...

2019-06-27 21:46:24 205

转载 inline functin vs #define

Why should I use inline functions instead of plain old #define macros?Unlike #define macros, inline functions avoid infamous macro errors since inline functions always evaluate every argument exactly...

2019-06-26 22:49:51 123

原创 difference between 'typedef' and 'using' in C++11

文章目录What is the difference between 'typedef' and 'using' in C++11Interesting pointsConclusionWhat is the difference between ‘typedef’ and ‘using’ in C++11Apart from ‘using’ can be used within templa...

2019-06-26 22:47:37 121

原创 Name mangling in C++

文章目录Name mangling in C++Name mangling in C++Mangling is simply how the compiler keeps the linker happy.In C, you can’t have two functions with the same name, no matter what. So that’s what the link...

2019-06-24 21:18:17 161

原创 Difference between private, public, and protected inheritance

文章目录Difference between private, public, and protected inheritanceMore elaborate explainationIntresting pointsDifference between private, public, and protected inheritanceFirst, let’s talk about the ...

2019-06-24 21:17:08 165

原创 const variale vs #define

文章目录Why should use const variable other than #define?Why should use const variable other than #define?The things you may consider are as followings:const variable obey the language’s scoping rules...

2019-06-24 21:16:13 70

转载 Multiple and Virtual Inheritance

转 Inheritance — Multiple and Virtual Inheritance文章目录转 [Inheritance — Multiple and Virtual Inheritance][1]Things you have to consider when you make design decisionsWhat does it mean to “delegate to a ...

2019-06-18 21:48:12 150

原创 #include directive

文章目录The #include Directive#include ``#include "file"#include anything elsedifference between #include `` and #include “filename”#include ``#include "filename"What if you want to reuse some files that ...

2019-06-18 21:46:20 306

原创 友元类和友元函数

文章目录Friend class and function in C++Friend classFriend function注意事项Friend class and function in C++Friend classFriend Class. 友元类可以是另一个类访问当前类的私有数据和方法. 如下例:class Node{private: int key; Node *n...

2019-06-17 21:31:40 831

转载 Multiple Inheritance Considered Useful

转 Multiple Inheritance Considered Useful这篇博文较长,需要耐心看完Multiple Inheritance Considered UsefulBy Jack W. Reeves, February 01, 2006Arguments against multiple inheritance range from the philosophical t...

2019-06-13 21:54:10 627

原创 error use of deleted function in c++

怎么触发的在做virtual inheritance测试的时候, 如下代码会触发:class DiamondBase{public: DiamondBase(int at) : m_attack(at) { } virtual void bark() = 0;private: int m_attack;};class DiamondLeft : publi...

2019-06-13 21:51:47 19526

原创 windows下拉取Android源码

文章目录准备工作获取仓库配置文件选择版本开始下载参考这里的方式准备工作git (自行下载安装)python(2或3)均可获取仓库配置文件先到自己磁盘位置, 找一个空间充裕的目录下, 新建源码仓库目前, 进入目录后执行以下命令:git clone https://aosp.tuna.tsinghua.edu.cn/platform/manifest这里使用的清华的镜像, goo...

2019-06-11 22:01:57 483

原创 Common C++ Error Messages : Undefined reference

文章目录Common C++ Error Messages : Undefined reference简述编译基础哪些情况会触发该错误总结Common C++ Error Messages : Undefined reference简述我们编译代码时经常会遇到这个错误, 其实这个错误是连接器触发的. 为了解决这个问题我们需要知道一些基础编译基础我们的代码编译大致分2部. 编译和链接通常...

2019-06-10 20:21:00 210

原创 Are Flexible Array Members valid in C/C++

文章目录Are Flexible Array Members valid in C/C++Flexible Array Members 是什么?有什么用注意事项Are Flexible Array Members valid in C/C++Flexible Array Members 是什么?我们在浏览代码时, 会见到如下代码:struct foo{ int length; ...

2019-06-10 20:19:33 185

转载 casts in c++

转载When should static_cast, dynamic_cast, const_cast and reinterpret_cast be used?How do you explain the differences among static_cast, reinterpret_cast, const_cast, and dynamic_cast to a new C++ pro...

2019-05-27 20:19:05 309

原创 c++11 specifier: override or final

文章目录override specifierfinal specifierInteresting pointsoverride specifieroverride是C++11 引入的修饰符. 它最重要的2个作用:它告诉我们, 这个方法是虚函数, 我们正在重载基类的虚函数它让编译器去检查是否真的在重载虚函数, 而不是新增成员函数例子class B{public: virt...

2019-05-19 21:22:09 280

转载 Why class member function template can not be virtual in c++

转Why class member function template can not be virtual in c++文章目录A little backgroundWhat's the difference between how virtual and non-virtual member functions are called?ExplanationA little backgrou...

2019-05-10 22:52:10 558

原创 c++11 enum class

文章目录c++11中新的枚举c++11中新的枚举c++11 中引入了enum class, 相对于传统的enum. 克服了以下传统问题:传统enum可隐式转换为int, 对不想如此的编程人员会造成错误传统enum会将其范围提升为全局, 可能会造成名字冲突传统enum底层类型无法指定, 造成误解, 兼容性问题和不能前向声明简单例子: enum Level { ...

2019-05-10 21:52:34 484

转载 Linux Daemon Writing HOWTO

文章目录Linux Daemon Writing HOWTOIntroduction: What is a Daemon?Getting StartedPlanning Your DaemonWhat Is It Going To Do?How Much Interaction?Basic Daemon StructureForking The Parent ProcessChanging The...

2019-05-08 20:40:56 152

原创 Virtual Memory图示

文章目录概念内存寻址加载概念内存寻址加载

2019-05-06 21:09:47 200

转载 Variadic templates in C++

转Variadic templates in C++文章目录IntroVariadic templatesBasic exampleSome simple variationsPerformanceType-safe variadic functionsVaridic data structuresVariadic templates for catch-all functionsVariadi...

2019-05-04 21:22:29 395

原创 std::addressof的实现理解

文章目录std::addressof的实现怎么理解std::addressof的实现标准库中有一个std::addressof, 这个东西存在的目的是当存在operator&的重载时, 依然能够获得变量的地址. gcc(4.7.1)下的实现如下:template<typename __Tp>inline __Tp* __addressof(_Tp& __r) ...

2019-04-29 21:30:13 3871 1

原创 warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

文章目录ProblemBasic meaning and syntaxConstant expressionsSo when do I actually have to use `constexpr`?When can I/should I use both, const and constexpr together?Fixing the problemProblemIf you ever w...

2019-04-22 20:14:22 2786

原创 Symmetric Multiprocessors

文章目录定义优势图例定义SMP可以认为使有一下特性的单机系统:有2个或2个以上的相同能力的处理器这些处理器共享主内存和I/O设备. 通过总线或其他内部连接方式, 因此每个处理器内存访问时间基本一致所有处理器通过相同通道或不同通道来访问相同的I/O设备所有处理器的功能相同任务,文件,数据等通过操作系统来协调交互优势SMP相对于单处理器的优势如下:性能. 由于并行处理的优势,...

2019-04-21 23:00:42 282

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除