2014年3月12日

jsoncpp 生成 json 字符串

摘要: Json::Value root; Json::Value arrayObj; Json::Value item; for (int i=0; i<10; i++) { item["key"] = i; item["value"] = 10*i; arrayObj.append(item); } root["key1"] = "value1"; root["key2"] = "value2"; root["array"] = arrayObj; ro 阅读全文

posted @ 2014-03-12 20:15 雪 狼 阅读(1414) 评论(0) 推荐(0)

replace() replace_copy()

摘要: int a[] = {1,2,3,3,4}; vector v(a, a+5); vector v2;//replace(v.begin(), v.end(), 3, 9); //把 v 中的3 替换为 9 replace_copy(v.begin(), v.end(), back_inserter(v2), 3, 9); //把 v 中的3 替换为 9 赋值给v2 ,v的值不变 for (int i =0; i iVec( ia, ia+7 ); cout ::iterator it = iVec.begin(); it != iVec.end(); ++it ) { cout iL... 阅读全文

posted @ 2014-03-12 10:10 雪 狼 阅读(446) 评论(0) 推荐(0)

导航