I wrote a software that accelerates the speed of the code. Flashime
One of the data structures (CCANDBUF) stores buffers from multiple dictionaries.
When I design this data structure, I want to think that the type of buffer cannot be otherwise other than Vector, so I will define CCANDBUF's core data members as public, so the purpose is to It is convenient to sort the data.
Public: std :: vector
When you actually use the words in the temporary dictionary, it is best to sign a color sign because only the words of the temporary dictionary can be deleted. However, the setting of the current data structure makes it no separately after reading the buffer from the word. I have to modify std :: vector
So I have to revert_cand_buf to private data members. Then put access to _cand_buf is encapsulated by excuses. Otherwise I modified _cand_buf's type involved many of the code of the entire program.
#include
// Warning: T Must Support Value Copy Template
Unsigned long size () {return_cand_buf.size ();} void clear () {_cand_buf.clear (); _selected = 0; _cand_buf.reserve (1024);} BOOL EMPTY () {Return_cand_buf.empty (); void push_back (const T & e) {_cand_buf.push_back (e);} const T & get_elem (unsigned int i) {return _cand_buf;} unsigned int selected () {return _selected;} unsigned int selected_page_start () {return _selected / _pagesize * _pagesize;} unsigned int selected_page_end () {return _pagesize selected_page_start ()> _ cand_buf.size () _ cand_buf.size (): _ pagesize selected_page_start ();} void set_selected (unsigned int i) {_selected = i;} unsigned int? PageSize () {return_pagesize;
Void filter_self (Bool (* is_removable) ({std :: vector
Void Sort (Bool (* less_cand) (T, T, T, T)) {std :: sort (_cand_buf.begin (), _ Cand_buf.end (), Less_cand);
PRIVATE: Std :: Vector