As per Mark Ransoms answer on using memset, i am using memset on a vector<int>
to assign values to all the elements.
memset(&match_begin[0], 0xff , sizeof(match_begin[0]) * match_begin.size());
It does have a significant performance improvement over std::fill
and it works fine(g++ 4.3.2, 64bit linux). Is this code safe , as in , would std::vector implementations always guarantee that memory allocation for the data will be contiguous? Is it possible that in a future(or different) implementation of the stl library that this might change and break my code later?