linux mint下使用fcitx5-rime指南
用户目录 $HOME/.local/share/fcitx5/rime
静态库制作及步骤 将 .c 生成 .o 文件 gcc -c add.c -o add.o 使用 ar 工具,制作静态库 ar rcs lib库名.a add.o sub.o div.o 编译静态库到可执行文件中 gcc test.c lib库名.a -o a.out 动态库制作及使用步骤 将 .c 生成 .o 文件 gcc -c add.c -o add.o -fPIC 使用 gcc -shared 制作动态库 gcc -shared lib库名.so add.o sub.o div.o 编译可执行文件,指定所使用的动态库 -l 指定库名 -L 指定库路径 gcc test.c -o a.out -l库名 -L./lib -I./inc 运行程序前的准备 export LD_LIBRARY_PATH=./lib 运行
一、str.find() 在字符串str中查询子串的位置 #include <iostream> using namespace std; int main() { string str = "abcdefg"; size_t pos = str.find("bcd"); if(pos != string::npos) { // string::npos cout << pos << endl; // pos 为 1 } } 二、str.find_first_of() 在字符串str中查询字符的位置 #include <iostream> using namespace std; int main() { string str = "abcdefg"; size_t pos = str.find_first_of("bcd"); // 查询 'b' || 'c' || 'd' 在 str 的第一个位置 if(pos != string::npos) { // string::npos cout << pos << endl; // pos 为 1 } } 三、find() 在指定范围内,查询元素的位置(一般为有迭代器的对象或容器) #include <iostream> #include <algorithm> using namespace std; int main() { string str = "abcdef"; string::iterator pos = find(str.begin(), str.end(), 'b'); if (pos != str.end()) { cout << *pos << endl; } } 四、find_if() 在指定范围内,查询符合条件的元素的位置(一般为有迭代器的对象或容器) #include <iostream> #include <algorithm> using namespace std; template <typename T> class condition { public: condition(const T& str): m_str(str) {}; bool operator()(const T& str) { if(str > m_str) return true; return false; } private: T m_str; }; int main() { string str = "abcdefg"; string::iterator pos = find_if(str.begin(), str.end(), condition('b')); if (pos != str.end()) { cout << *pos << endl; } }
抽象 朱光潜《形象思维在文艺中的作用和思想性》“抽象就是‘提炼’,也就是毛泽东同志在《实践论》里所说的‘将丰富的感觉材料加以去粗取精、去伪存真、由此及彼、由表及里的改造制作工夫。’”