dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: ninja9578

Search: Search took 0.01 seconds.

  1. Re: Why does std::vector require its elements to be assignable?

    You can always build your own container. You only have a few functions that you are using, so create your own container and you can have it do whatever you want. STL is there for convenience, it...
  2. Re: Why does std::vector require its elements to be assignable?

    Because:

    vector<string> vec;
    vec.push_back("hello world");
    string & ref = vec[0];
    vec[0] = "hello mars";
    If you literally replaced vec[0] with a new string, where does ref point?

    Also, some...
  3. Re: Why does std::vector require its elements to be assignable?

    In that case I would rethink your container needs. Sounds like you need std::stack instead. The right container for the right job.

    You could always write your own vector, for only a few...
  4. Re: Why does std::vector require its elements to be assignable?

    Because you can assign elements.

    void setAllToZero(vector<int> & vec){
    foreach(vec, iterator){
    *iterator = 0;
    }
    }
Results 1 to 4 of 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)