Convert double vector treenode to string vector.
int convert_tree_double_vector_to_str_vector( const TreeNode & trVec, vector<string> & vs, uint nSize, string strFmt = "*" )
int convert_tree_double_vector_to_str_vector( const TreeNode & trVec, vector<string> & vs, const vector<int> & vnSignDigites = NULL )
Returns the -1 when trVec not double vector. else return the size of vs.
EX1
void test_convert_tree_double_vector_to_str_vector_ex1() { Tree tr; vector vd = {1,2,3,4.0989}; tr.tr1.dVals = vd; vector<string> vs; int nRet = convert_tree_double_vector_to_str_vector(tr.tr1, vs, vd.GetSize(),"*3"); for(int nIndex =0 ; nIndex < vs.GetSize(); nIndex++) out_str(vs[nIndex]);//output 1.00, 2.00, 3.00, 4.10 }
EX2
void test_convert_tree_double_vector_to_str_vector_ex2() { Tree tr; vector vd = {1,2,3,4.0989}; vector<int> vsd = {1,2,3,4}; tr.tr1.dVals = vd; vector<string> vs; int nRet = convert_tree_double_vector_to_str_vector(tr.tr1, vs, vsd); for(int nIndex =0 ; nIndex < vs.GetSize(); nIndex++) out_str(vs[nIndex]);//output 1, 2.0, 3.00, 4.099 }
origin.h