c++ - Iterator over a unique element without construction a container -


i have framework has requires input iterator. sometime, have single element, constructing container seems work.

t obj; // unique object  std::vector<t> vec; // want avoid vec.push_back(t);  // because use of container call call(std::begin(vec), std::end(vec));  // want call(beginfakesingletonit<t>(obj), endfakesingletonit<t>()); 

i create special type of iterator, doesn't exist in standard library or boost?

a single element can thought of array of size one. if use pointer object pointer(iterator) start of array , pointer 1 past end of array pointer incremented once. can use

call(&object, &object + 1) 

and process single object.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -