Time of Update: 2018-07-18
#include <string> #include <map>#include <iostream>#include <algorithm>#include <vector>using namespace std; //建構函式對象,指定pair 比較的規則 bool mod_equal(std::pair<const std::string,std::string>
Time of Update: 2018-07-18
引用 using System.Runtime.InteropServices; [DllImport("kernel32.dll", EntryPoint = "GetSystemDefaultLCID")] public static extern int GetSystemDefaultLCID(); [DllImport("kernel32.dll", EntryPoint =
Time of Update: 2018-07-18
移植於log4j的c/c++類Tlog項目大全 log4c Summary:ANSI C functions and macros for flexible logging to files and other destinations. It is modeled after the Log for Java library (http://www.log4j.org), staying as close to their API as is reasonable.
Time of Update: 2018-07-18
/*************************************************** 1. 模板特化按物件類型(類和全域函數)分為兩種: 類模板的特化和通用範本函數的特化; 2. 按特化的類型分全特化和偏特化(也就是多個模板參數可以選定只特化一個或者多個),通用範本函數的特化不支援偏特化; 3. 通用範本函數的特化需要關注幾個重要元素函數傳回值 函數名 形參類型、個數和順序,eg: template <class T> T max_(const
Time of Update: 2018-07-18
/* prepare.cpp 示範了閱讀 STL 原代碼的一些預備知識 1. 模版以及模版的偏特化,是 STL 原始碼裡面用的很多的技術, 有效解決了支援不同參數個和類型的問題; 2. 各式各樣的宏定義,用於定義建構函式,重載函數實現,需要不斷的展開, 這個也是平時代碼很少見的特徵 */ //標明是使用 MS版本,本處使用 VS2012 update 4 #include "stdafx.h" #include <iostream> #include <
Time of Update: 2018-07-18
GCC 能夠編譯三種語言:C、C++ 和 Object C(C 語言的一種物件導向擴充)。利用 gcc 命令可同時編譯並串連 C 和 C++ 來源程式。 #DEMO#: hello.
Time of Update: 2018-07-18
Compiling C 出自Ubuntu中文 目錄 [隱藏] 1 C 編程中相關檔案尾碼 2 單個源檔案產生可執行程式 3 源檔案產生對象檔案
Time of Update: 2018-07-18
// function.cpp : /* 測試例子示範了函數指標的的各種組合以及調用的方式 如果你的編譯器編譯失敗,請儘可能的先去掉 const 後編譯,如果全部去掉後 還是編譯失敗,請把你的編譯器升級到最高版本或者換了它。 */ #include "stdafx.h" #include "stdafx.h" #include <functional> #include <string> #include
Time of Update: 2018-07-18
[C++ 2011 STL (VS2012 Update4) 原始碼閱讀系列(2)]熟悉一些宏定義和模版偏特化或叫模版專門化 // point_test.cpp : 知識點練習和測試,用於單步調試,跟蹤。 // #include "stdafx.h" #include <functional> #include <string> #include <iostream> using namespace std; //
Time of Update: 2018-07-18
/* cblockingdeque.h 描述了阻塞隊列的實現 */ #ifndef _H_CBLOCKINGDEQUE_INCLUDE_ #define _H_CBLOCKINGDEQUE_INCLUDE_ #include <mutex> #include <deque> #include <condition_variable> //阻塞式隊列 template <typename T> class CBlockingDeque {
Time of Update: 2018-07-18
/* thread.cpp 示範了建立線程的多種方法 */ #include <iostream> #include <sstream> #include <functional> #include <thread> #include <future> #include <unordered_map> #include <vector> #include <algorithm>
Time of Update: 2018-07-18
C++ 中有三類迭代器,分別是插入迭代器(inserter),反向迭代器(reverse_iterator)和流迭代器. 這裡(vs2003為例)介紹插入迭代器,插入迭代器分別是std::inserter_iterator,std::back_inserter_iterator,std::front_inserter_iterator 三類,對應的迭代器適配器應該是 std::inserter,std::back_inserter,std::front_inserter 。 1.
Time of Update: 2018-07-18
int main(int argc,char *argv[]){ char *c_array[5] = {"AAAA", "BBBB", "CCCC","DDDD","EEEE"}; //構造指標數組(指代數組裡面的值儲存的是指標)的指標 char **p_a = c_array; //數組的名稱是一個地址,其第一個元素的地址等同其名稱 p_a =
Time of Update: 2018-07-18
//送佛送到西,好人做到底//使用 C/c++ 標準庫實現/*C 語言標準 I/O 函數介紹1. 庫檔案一般位於 <stdio.h> 或者 <fcntl.h> 庫中2. 函數介紹2.1 FILE * fopen(const char * filepath,const char * type);開啟檔案主要有模式有b -> 按位元組流w -> 清除原來檔案內容寫檔案或者建立檔案a -> 追加檔案r -> 讀檔案這些函數可以組合使用成功 返回不為空白,
Time of Update: 2018-07-18
//一些C++中字串處理的函數集合 #include <algorithm>#include <vector>#include <string> class MyString{private: //public: //將指定字串轉換為大寫 const std::string& upperstring(std::string
Time of Update: 2018-07-18
C 語言標準中一些預定義的宏 C標準中指定了一些預定義的宏,對於編程經常會用到。下面這個表中就是一些常常用到的預定義宏。 __DATE__進行預先處理的日期(“Mmm dd yyyy”形式的字串文字) __FILE__代表當前原始碼檔案名稱的字串文字 __LINE__代表當前原始碼中的行號的整數常量 __TIME__源檔案編譯時間,格式類似 "hh:mm:ss",字串類型 __func__當前所在函數名,也是字串類型,C99 新增,VC6 就不支援.
Time of Update: 2018-07-18
★ 相同點: 1. 都是地址的概念; 指標指向一塊記憶體,它的內容是所指記憶體的地址;引用是某塊記憶體的別名。 ★ 區別: 1. 指標是一個實體,而引用僅是個別名; 2. 引用使用時無需解引用(*),指標需要解引用; 3.
Time of Update: 2018-07-18
下面用通俗易懂的話來概述一下: 指標-對於一個類型T,T*就是指向T的指標類型,也即一個T*類型的變數能夠儲存一個T對象的地址,而類型T是可以加一些限定詞的,如const、volatile等等。見下圖,所示指標的含義: 引用-引用是一個對象的別名,主要用於函數參數和傳回值類型,符號X&表示X類型的引用。見下圖,所示引用的含義: 2、指標和引用的區別
Time of Update: 2018-07-18
pthread_create的使用 int pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*) 要使g++編譯通過,方法如下: C++禁止將void指標隨意賦值給其他指標。 因此你在把void
Time of Update: 2018-07-18
1.關於backspace getchar從標準輸入的緩衝區讀字元,backspace根本進不了緩衝區。所以應該使用無緩衝的讀字元函數:getch(),包含在標頭檔<conio.h>中。