Search Results

Search found 5 results on 1 pages for 'madhavan'.

Page 1/1 | 1 

  • STL map inside map C++

    - by Prasanth Madhavan
    In c++ STL map, i have a definition like map<string, map<int, string> >; and i iterate it using the following code. for( map<string, map<int, string> >::iterator ii=info.begin(); ii!=info.end(); ++ii){ for(map<int, string>::iterator j=ii->second.begin(); j!=ii->second.end();++j){ cout << (*ii).first << " : " << (*j).first << " : "<< (*j).second << endl; } } My doubt is is this the correct way to iterate or is there a better way to do so? The above code works for me. But m looking for a more elegant solution.

    Read the article

  • Removing a character from a string

    - by Prasanth Madhavan
    i have a string. I want to delete the last character of the string if it is a space. i tried the following code, str.erase(remove_if(str.begin(), str.end(), isspace), str.end()); but my g++ compiler gives me an error saying: error: no matching function for call to ‘remove_if(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unresolved overloaded function type>)’ please help.

    Read the article

  • Kindle Fire Cant Fit My Webpage inside a Webview of specific size

    - by Madhavan Rangarao
    This is baffling to me. Please help, I could not figure it out ... In my sample html file I have set the meta tag to be <meta name="viewport" content="target-densitydpi=device-dpi, user-scalable=no"> to fit the webpage inside my webview of custom size say 800x600. In Android, I had to specify "target-densitydpi=device-dpi" and it did the job nicely. I tested my custom web page with nexus 7 tablet and the web page fits inside my web view correctly. The same code does not work in Kindle Fire. Only a part of my web page is shown and even if I set the 'initial-scale=1.0' did not help. I tried various settings programmatically but it did not help either. webview.getSettings().setBuiltInZoomControls(true); webview.getSettings().setSupportZoom(true); webview.getSettings().setLoadWithOverviewMode(true); webview.setInitialScale(1); webview.getSettings().setUseWideViewPort(true); Any pointers?

    Read the article

  • passing multiple vectors to function by reference (using structure)

    - by madman
    Hi StackOverflow, Can someone tell me the correct way of passing multiple vectors to a function that can take only a single argument? (specifically for pthread_create (..) function) I tried the following but it does not seem to work :-( First, I created the following structure struct ip2 { void* obj; int dim; int n_s; vector<vector<vector<double> > > *wlist; vector<int> *nrsv; struct model *pModel; }; The threads that I have created actually needs all these parameters. Since im using pthreads_create I put all this in a structure and then passed the pointer to the structure as an argument to pthread_create (as shown). some_fxn() { //some code struct ip2 ip; ip.obj=(void*) this; ip.n_s=n_s; ip.wlist=&wlist; ip.nrsv=&nrsv; ip.pModel=pModel; ip.dim=dim; pthread_create(&callThd1[lcntr], &attr1, &Cls::Entry, (void*) &ip); } The Entry method looks something like this. void* Cls::Entry(void *ip) { struct ip2 *x; x = (struct ip2 *)ip; (reinterpret_cast<Cls1 *>(x->obj))->Run(x->dim,x->n_s, x->wlist, x->nrsv, x->pModel); } The Run method looks something like this. void Run(int dim, int n_c, vector<vector<vector<double> > > *wlist, vector<int> *nrsv, struct model* pModel ) { //some code for(int k = 0; k < n_c; ++k) { //some code end = index + nrsv[k]; //some code } I get the following error when I try to compile the program. error: no match for ‘operator+’ in ‘index + *(((std::vector<int, std::allocator<int> >*)(((unsigned int)k) * 12u)) + nrsv)’ Can someone tell me how to do it the right way. Madhavan

    Read the article

1