本文整理汇总了C++中vs类的典型用法代码示例。如果您正苦于以下问题:C++ vs类的具体用法?C++ vs怎么用?C++ vs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了vs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toString
//debugging purpose
void toString(){
cerr << "Call name: " << call_fun_name << " | Functions: ";
for(vs::iterator i = function_uses.begin(); i != function_uses.end(); i++){
cerr << *i << " ";
}
cerr << "| Pairs Size " << pairs.size() << endl;
}
示例2: containsElem
//----------------------------------------------------------------------------
// Returns true if a given vector<string> contains given string
//----------------------------------------------------------------------------
bool containsElem(vs list, string value) {
for (vs::iterator it = list.begin(); it != list.end(); it++) {
if (*it == value) {
return true;
}
}
return false;
}
示例3: parse_obstacles
vvb parse_obstacles(const vs &initial_map) {
vvb obstacles(initial_map.size()+2, vector<bool>(initial_map[0].size()+2, true));
for (int i = 0; i < initial_map.size(); i++) {
for (int j = 0; j < initial_map[i].size(); j++) {
obstacles[i+1][j+1] = (initial_map[i][j] == '*');
}
}
return obstacles;
}
示例4: BuildPath
void BuildPath(map<string, vs> &traces, vvs &pathes, vs &path, string word, string start){
if(word == start){
path.push_back(word);
vs tmp = path;
reverse(tmp.begin(), tmp.end());
pathes.push_back(tmp);
path.pop_back();
return;
}
path.push_back(word);
vs tmp = traces[word];
for(int i = 0; i < tmp.size(); ++i)
BuildPath(traces, pathes, path, tmp[i], start);
path.pop_back();
}
示例5: print
void print(vs v){
int n=v.size();
for(int i=0;i<n; i++){
cout<<v[i]<<endl;
}
cout<<n;
}
示例6: main
int main(void) {
std::ios_base::sync_with_stdio (false);
size_t n;
cin >> n >> ws;
vvs graph(n, vs());
dfs_num.resize(n, 0);
parent.resize(n, -1);
finished = false;
a = b = c = -1;
string line;
for (size_t line_cnt = 0; line_cnt < n; line_cnt++) {
getline(cin, line);
for (size_t char_cnt = 0; char_cnt < n; char_cnt++) {
if (line.at(char_cnt) == '1')
graph[line_cnt].push_back(char_cnt);
}
}
for (size_t counter = 0; counter < n; counter++)
if (!dfs_num[counter])
dfs(graph, counter);
if (a >= 0)
cout << a+1 << " " << b+1 << " " << c+1 << endl;
else
cout << -1 << endl;
return 0;
}
示例7: worker
void worker(vs &ret, int level, int pos, string s) {
if(level == 3) {
if(s.size() - pos > 3) return;
else {
string t = s.substr(pos, 3);
if(t[0] == '0' && t.size() != 1) return;
if(stoi(t) <= 255) {
ret.push_back(s);
}
}
return;
}
if(s[pos] == '0') {
string temp = s;
if(pos + 1 >= s.size()) return;
temp.insert(pos + 1, 1, '.');
worker(ret, level + 1, pos + 2, temp);
return;
}
for(int i = pos; i < pos + 3; ++i) {
if(i == pos + 2) {
if(stoi(s.substr(pos, 3)) > 255) {
continue;
}
}
string temp = s;
if(i + 1 >= s.size()) return;
temp.insert(i + 1, 1, '.');
worker(ret, level + 1, i + 2, temp);
}
}
示例8: solve
void solve(vs names,vs towns)
{
int n=names.size();
vs res(n);
map<string,int> f;
rep(i,n){
res[i]=shorten(names[i],towns[i]);
f[res[i]]++;
}
示例9: format_data
//SBSI has members h, wc, bsa and vtc.
vs* format_data(double data[][5])
{
static vs output;
for(int i = 0;
data[i][0] != 0
|| data[i][1] != 0
|| data[i][2] != 0
|| data[i][3] != 0
|| data[i][4] != 0;
i++){
string* tmp = new SBSI;
tmp->h = data[i][0];
tmp->wc = data[i][1];
tmp->bsa = data[i][2];
tmp->vtc = data[i][3];
tmp->expected = data[i][4];
output.push_back(tmp);
//cout << "Pushed back " << output[i]->h << endl;
}
return &output;
/* char* p1 = data;
char* p2 = p1;
int n = 0;
int counter = 0, length = 0;
while ( p1[0] != '\0') {
SBSI temp;
while ( p1[0] != ',') {
while(!isalpha(p1[0]))
++p1;
p2 = p1+1;
while(*p2 != '\0') {
if(*p2 == '\t')
length++;
break; //Element delimiter.
}
}
}
*/
}
示例10: fill
string fill(vs ss)
{
int p=ss.size();
string res;
for(int i=0;i/p<ss[i%p].size();i++){
char c=ss[i%p][i/p];
res+=c=='.'?'0':c;
}
return res;
}
示例11: find_king
pii find_king(const vs &initial_map) {
for (int i = 0; i < initial_map.size(); i++) {
for (int j = 0; j < initial_map[i].size(); j++) {
if (initial_map[i][j] == 'X') {
return make_pair(i+1, j+1);
}
}
}
// never reaches
}
示例12: solve_naive
string solve_naive(vs ss)
{
int k=ss.size(),n=ss[0].size();
rep(i,k){
string s=ss[0]; sort(all(s));
string t=ss[i]; sort(all(t));
if(s!=t)
return "-1";
}
示例13: returnIndexOfVector
/*
* Returns an integer which is the index
* of a string in a vector of strings
*/
int returnIndexOfVector(vs &stringVector, string value)
{
int iii;
for (iii = 0; iii < stringVector.size(); iii++) {
if (stringVector[iii] == value) {
return iii;
}
}
return -1;
}
示例14: newMemberTwo
string newMemberTwo(vs existingNames, string newName)
{
set<string> names(existingNames.begin(), existingNames.end());
if(names.count(newName) == 0 )
return newName;
char testName[1024];
int currentInt = 1;
while(1)
{
sprintf(testName, "%s%d", newName.c_str(), currentInt);
if(names.count(testName) == 0)
return testName;
else
currentInt++;
}
}
示例15: main
int main()
{
int n;
while(cin>>n && n)
{
map<string,bool> sw;
string s,abr;
for(int i=0;i<n;i++){
cin>>s;
sw[s]=1; //mark insignificant words
}
getline(cin,s);
while(getline(cin,s) && s!="LAST CASE")
{
w.clear();
stringstream ss;
ss<<s;
ss>>a;
abr=a;
for(int i=0;i<a.size();i++) a[i]=tolower(a[i]);
while(ss>>s)
if(sw.find(s)==sw.end())
w.PB(s);
memset(dp,-1,sizeof(dp));
int res=solve(0,0,0);
if(res==0)
cout<<abr<<" is not a valid abbreviation"<<endl;
else
cout<<abr<<" can be formed in "<<res<<" ways"<<endl;
}
}
}