<div class="gmail_quote">Hi Martin,</div><div class="gmail_quote"><br></div><div class="gmail_quote">On 29 August 2011 13:15, Martin B. <span dir="ltr"><<a href="mailto:0xCDCDCDCD@gmx.at">0xCDCDCDCD@gmx.at</a>></span> wrote:</div> <div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On 26.08.2011 20:21, Ovanes Markarian wrote:<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"> On Fri, Aug 26, 2011 at 2:30 PM, Martin B. <<a href="mailto:0xCDCDCDCD@gmx.at" target="_blank">0xCDCDCDCD@gmx.at</a><br></div><div class="im"> <mailto:<a href="mailto:0xCDCDCDCD@gmx.at" target="_blank">0xCDCDCDCD@gmx.at</a>>> wrote:<br><br> � �Say I have a range R and I want to construct a new container from<br> � �the range R. Will I always have to repeat the expression yielding<br> � �the range, or is there a shorter way?<br> <br> � �Example:<br> <br> � � � �std::vector<int> numbers(<br> � � � � �boost::irange(7, 42).begin(),<br> � � � � �boost::irange(7, 42).end()<br> � � � �);<br> <br> What about that:<br></div> ...<div class="im"><br> integer_range<int> ir=irange(7,42);<br> vector<int> numbers(ir.begin(), ir.end());<br> <br> </div></blockquote> <br> For this to work I need the exact type of the range, which can be quite annoying as far as I could tell. (Plus, I *don't want* to care what type of the range is.)<br> <br> Really, if I had C++11/auto, I wouldn't mind so much, i.e.<br> <br> � �auto xr = get_some_range(...);<br> � �vector<int> numbers(xr.begin(), xr.end());<br> <br> but I don't have an `auto` capable compiler, so spelling out the range type for this is really crappy.<br></blockquote><div><br></div><div>If you don't care about the type of range, you could always try:</div><div> <br></div><div>BOOST_AUTO( xr, get_some_range(...) );</div><div>vector<int> numbers( xr.begin(), xr.end() );�</div><div><br></div><div><a href="http://www.boost.org/doc/libs/1_47_0/doc/html/typeof/refe.html#typeof.auto">http://www.boost.org/doc/libs/1_47_0/doc/html/typeof/refe.html#typeof.auto</a></div> <div><br></div><div>Cheers,</div><div>Darren</div></div>