c++11的模板类型判断std::is_same和std::decay
问题提出:有一个模板函数,函数在处理int型和double型时需要进行特殊的处理,那么怎么在编译期知道传入的参数的数据类型是int型还是double型呢?
如:
1 | #include <iostream> |
这里就需要用到C++11的type_traits头文件了,type_traits头文件定义了很多类型检查相关的方法,上面的例子具体用到了其中两个结构:
Git 基础操作手册:从入门到进阶
1. Git 数据流转模型
理解 Git 的核心在于掌握数据在不同区域间的流转。
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#4F46E5', 'primaryTextColor': '#fff', 'primaryBorderColor': '#3730A3', 'lineColor': '#6366F1', 'secondaryColor': '#10B981', 'tertiaryColor': '#F59E0B'}}}%%
flowchart LR
Workspace["工作区<br/>(Workspace)"] -->|"git add"| Index["暂存区<br/>(Index/Stage)"]
Index -->|"git commit"| Repository["本地仓库<br/>(Local Repo)"]
Repository -->|"git push"| Remote["远程仓库<br/>(Remote Repo)"]
Remote -->|"git pull/fetch"| Repository
Repository -->|"git checkout/restore"| Workspace
classDef primary fill:#4F46E5,stroke:#3730A3,color:#fff
class Workspace,Index,Repository,Remote primaryxcode自定义Eclipse中常用的快捷键
首先找到Xcode中的自带的配置文件
1 | /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist |
这个文件里配置了一些可以设置快捷键的操作, 使用常用的编辑器打开它(需要root权限)。
1 | <key>GDI Commands</key> |
xcode主题
hexo博客使用docker部署和测试
2025-08-10 更新
好久不更新,发现 Theme-next 仓库都已经有好几个了。
参考: https://github.com/next-theme/hexo-theme-next/issues/546
shell批量文件内容复制到一个文件内
公司需要把所有代码放到一个文件内,加上版权信息. 于是用shell简单的处理了下
1 | #!/bin/sh |
python使用正则后向引用替换字符串
工作需要把
Mud makes my mom mad.这句话带有m的加上颜色,或者把某些单词加上颜色
临时写了个脚本处理
1 | import re |
mac系统vim升级流程
执行命令安装vim 注意要加上--with-override-system-vi
1 | brew install vim --with-override-system-vi |
安装过程中如果出现 ruby.h找不到
执行下面的命令
1 | cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby |
1 | sudo ln -s ../universal-darwin15/ruby/config.h ./config.h |
注意不要复制上面的, 对应自己的sdk版本,ruby版本,darwin版本
golang配置vim
配置文件和快速设置
- [.vimrc][1]
- [.zhsrc][2]
[1]: https://github.com/unix2dos/go-tutorial/blob/master/.vimrc
[2]: https://github.com/unix2dos/go-tutorial/blob/master/.zshrc
- PlugClean
- PlugInstall
- 去到YCM里执行
1 | ./install.py --clang-completer --gocode-completer |
安装插件管理器
1 | curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |
安装插件
1 | call plug#begin() |