<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>http://groups.google.ca/group/comp.lang.c++.moderated</id>
  <title type="text">comp.lang.c++.moderated Google Group</title>
  <subtitle type="text">
  Technical discussion of the C++ language. (Moderated)
  </subtitle>
  <link href="/group/comp.lang.c++.moderated/feed/atom_v1_0_msgs.xml" rel="self" title="comp.lang.c++.moderated feed"/>
  <updated>2009-11-22T16:07:14Z</updated>
  <generator uri="http://groups.google.ca" version="1.99">Google Groups</generator>
  <entry>
  <author>
  <name>shahav</name>
  <email>sha...@gmail.com</email>
  </author>
  <updated>2009-11-22T16:07:14Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/49240ef30a49ca6a?show_docid=49240ef30a49ca6a</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/49240ef30a49ca6a?show_docid=49240ef30a49ca6a"/>
  <title type="text">Re: std::vector of const values</title>
  <summary type="html" xml:space="preserve">
  you should simply add one missing const : &lt;br&gt; int main() &lt;br&gt; { &lt;br&gt; int i1, i2, i3; &lt;br&gt; std::vector&amp;lt; const int* &amp;gt; ints; // note to the const before int &lt;br&gt; ints.push_back( &amp;amp;i1 ); &lt;br&gt; ints.push_back( &amp;amp;i2 ); &lt;br&gt; ints.push_back( &amp;amp;i3 ); &lt;br&gt; doStuff( ints ); &lt;br&gt; return 0;
  </summary>
  </entry>
  <entry>
  <author>
  <name>marcin.sfider@gmail.com</name>
  <email>marcin.sfi...@gmail.com</email>
  </author>
  <updated>2009-11-22T13:11:29Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/a17972c4ac3db4b3?show_docid=a17972c4ac3db4b3</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/a17972c4ac3db4b3?show_docid=a17972c4ac3db4b3"/>
  <title type="text">Re: std::vector of const values</title>
  <summary type="html" xml:space="preserve">
  I wouldn&#39;t worry about const correctness in this particular case. It &lt;br&gt; could &lt;br&gt; be an issue if you would write an interface for other programmer to &lt;br&gt; implement &lt;br&gt; and you wouldn&#39;t want him to mess data you pass to him. In this case I &lt;br&gt; can &lt;br&gt; think of two solutions: &lt;br&gt; 1. Easy way - provide doStuff virtual method for one parameter:
  </summary>
  </entry>
  <entry>
  <author>
  <name>Claudio Pacati</name>
  <email>pac...@unisi.it</email>
  </author>
  <updated>2009-11-22T13:16:28Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/f342a1d36b54deab/43a72de94b188ad0?show_docid=43a72de94b188ad0</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/f342a1d36b54deab/43a72de94b188ad0?show_docid=43a72de94b188ad0"/>
  <title type="text">Re: istringstream constructor performance</title>
  <summary type="html" xml:space="preserve">
  &amp;lt;snip&amp;gt; &lt;br&gt; Did You remember to test performances with optimization turned on? &lt;br&gt; It makes a big difference with the C++ standard library. At least with &lt;br&gt; gcc. &lt;br&gt; Regards, Claudio Pacati
  </summary>
  </entry>
  <entry>
  <author>
  <name>Francis Glassborow</name>
  <email>francis.glassbo...@btinternet.com</email>
  </author>
  <updated>2009-11-22T13:15:32Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/3f109efb42e3b813?show_docid=3f109efb42e3b813</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/3f109efb42e3b813?show_docid=3f109efb42e3b813"/>
  <title type="text">Re: std::vector of const values</title>
  <summary type="html" xml:space="preserve">
  Dave wrote: &lt;br&gt; vectors instantiated with different types. int const * and int* are &lt;br&gt; completely different types. If you want to be able to deal with vectors of &lt;br&gt; different types write a template function: &lt;br&gt; template &amp;lt;typename type&amp;gt; &lt;br&gt; void doStuff(const std::vector&amp;lt;type *&amp;gt; &amp;amp; instances){ &lt;br&gt; for( size_t i(0); i != instances.size(); ++i )
  </summary>
  </entry>
  <entry>
  <author>
  <name>Taras Shevchuk</name>
  <email>sh...@gala.net</email>
  </author>
  <updated>2009-11-22T13:14:58Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/34a6f597eaeef058?show_docid=34a6f597eaeef058</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/34a6f597eaeef058?show_docid=34a6f597eaeef058"/>
  <title type="text">Re: std::vector of const values</title>
  <summary type="html" xml:space="preserve">
  Dave =D0=BD=D0=B0=D0=BF=D0=B8=D1=81 =D0=B0=D0=B2(=D0=BB=D0=B0): &lt;br&gt; #include &amp;lt;vector&amp;gt; &lt;br&gt; I propose to use iterators: &lt;br&gt; template &amp;lt;typename Iter&amp;gt; &lt;br&gt; void doStuff(Iter begin, Iter end) &lt;br&gt; { &lt;br&gt; for(Iter it = begin; it != end; ++it) &lt;br&gt; { &lt;br&gt; std::cout &amp;lt;&amp;lt; **it &amp;lt;&amp;lt; std::endl; &lt;br&gt; } &lt;br&gt; ... &lt;br&gt; doStuff( ints.begin(), insts.end());
  </summary>
  </entry>
  <entry>
  <author>
  <name>Nick Hounsome</name>
  <email>nick.houns...@googlemail.com</email>
  </author>
  <updated>2009-11-22T13:16:37Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/f1983b15b4c61e8d?show_docid=f1983b15b4c61e8d</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/f1983b15b4c61e8d?show_docid=f1983b15b4c61e8d"/>
  <title type="text">Re: std::vector of const values</title>
  <summary type="html" xml:space="preserve">
  consider &lt;br&gt; void doStuff( std::vector&amp;lt; const int* &amp;gt;&amp;amp; ints ) &lt;br&gt; This would be able to add const int* to what is actually &lt;br&gt; std::vector&amp;lt;int*&amp;gt; &lt;br&gt; Of course since it is actually passed as an immutable vector that &lt;br&gt; cannot happen but I think that that is getting too sophisticated. &lt;br&gt; One way to go would be to redefine doStuff as a template method taking
  </summary>
  </entry>
  <entry>
  <author>
  <name>Francis Glassborow</name>
  <email>francis.glassbo...@btinternet.com</email>
  </author>
  <updated>2009-11-22T13:13:28Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/f342a1d36b54deab/fc1e99883cbe7317?show_docid=fc1e99883cbe7317</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/f342a1d36b54deab/fc1e99883cbe7317?show_docid=fc1e99883cbe7317"/>
  <title type="text">Re: istringstream constructor performance</title>
  <summary type="html" xml:space="preserve">
  The basic problem is that you are imposing the overhead for &lt;br&gt; construction/destruction on your use. Stream classes of all kinds have &lt;br&gt; relatively expensive ctors/dtors. When you switch to static instnaces you &lt;br&gt; only pay the overhead once rather than every entry to the function. &lt;br&gt; If speed is an issue, you might try inlining ToDouble. Many compilers will
  </summary>
  </entry>
  <entry>
  <author>
  <name>n00m</name>
  <email>n...@narod.ru</email>
  </author>
  <updated>2009-11-22T04:53:08Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/fff4ce6c3fdfd2c6/e3b2bdb3f4fdb3d1?show_docid=e3b2bdb3f4fdb3d1</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/fff4ce6c3fdfd2c6/e3b2bdb3f4fdb3d1?show_docid=e3b2bdb3f4fdb3d1"/>
  <title type="text">Re: removing from set - does it have to be so ugly?</title>
  <summary type="html" xml:space="preserve">
  I think in-place-erasing totally corrupt the iterator. &lt;br&gt; The code erases all odd elements from a set&amp;lt;int&amp;gt;.... &lt;br&gt; but replace in &amp;quot;for(...; i &amp;lt;= 25; ...)&amp;quot; 25 with 55 &lt;br&gt; now &amp;quot;7&amp;quot; stays UN-erased &lt;br&gt; using namespace std; &lt;br&gt; void print(int elem) { &lt;br&gt; cout &amp;lt;&amp;lt; elem &amp;lt;&amp;lt; endl; &lt;br&gt; int main() { &lt;br&gt; set&amp;lt;int&amp;gt; r; &lt;br&gt; for (int i = 0; i &amp;lt;= 25; i += 5) r.insert(i);
  </summary>
  </entry>
  <entry>
  <author>
  <name>RRick</name>
  <email>rickara...@comcast.net</email>
  </author>
  <updated>2009-11-22T04:55:06Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/f342a1d36b54deab/eab0f4318d63059a?show_docid=eab0f4318d63059a</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/f342a1d36b54deab/eab0f4318d63059a?show_docid=eab0f4318d63059a"/>
  <title type="text">istringstream constructor performance</title>
  <summary type="html" xml:space="preserve">
  I have written some C style static methods that convert strings to &lt;br&gt; doubles, ints, longs, etc. using the C++ string stream objects. Each &lt;br&gt; of the converter methods use a locally constructed istringstream &lt;br&gt; object which uses the &amp;gt;&amp;gt; operator to make the conversions. A typical &lt;br&gt; method looks like: &lt;br&gt; double ToDouble( const string &amp;amp; str)
  </summary>
  </entry>
  <entry>
  <author>
  <name>Dave</name>
  <email>thedaverud...@gmail.com</email>
  </author>
  <updated>2009-11-22T04:52:27Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/1de860c1870ae1e2?show_docid=1de860c1870ae1e2</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/5996d4d3269d2e90/1de860c1870ae1e2?show_docid=1de860c1870ae1e2"/>
  <title type="text">std::vector of const values</title>
  <summary type="html" xml:space="preserve">
  Hi all, &lt;br&gt; I have run into this problem a few times and was hoping there was a &lt;br&gt; more elegant solution than what I was doing. Suppose I have the &lt;br&gt; following code: &lt;br&gt; void doStuff( const std::vector&amp;lt; const int* &amp;gt;&amp;amp; ints ) &lt;br&gt; { &lt;br&gt; for( size_t i = 0; i != ints.size(); ++i ) &lt;br&gt; std::cout &amp;lt;&amp;lt; *ints[ i ] &amp;lt;&amp;lt; std::endl;
  </summary>
  </entry>
  <entry>
  <author>
  <name>red floyd</name>
  <email>redfl...@gmail.com</email>
  </author>
  <updated>2009-11-22T04:50:49Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/400259ead753c6ca/f7cc9428dfafde62?show_docid=f7cc9428dfafde62</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/400259ead753c6ca/f7cc9428dfafde62?show_docid=f7cc9428dfafde62"/>
  <title type="text">Re: Copy C&#39;tor - doubt</title>
  <summary type="html" xml:space="preserve">
  No, only a single heap allocation will occur, as written.
  </summary>
  </entry>
  <entry>
  <author>
  <name>Richard Corden</name>
  <email>richard.cor...@gmail.com</email>
  </author>
  <updated>2009-11-20T21:10:26Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/aea0d9b7bd90eaea/e3618e46dc14defe?show_docid=e3618e46dc14defe</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/aea0d9b7bd90eaea/e3618e46dc14defe?show_docid=e3618e46dc14defe"/>
  <title type="text">Re: Question on goto with try/catch</title>
  <summary type="html" xml:space="preserve">
  Yes its Ok. &lt;br&gt; What you cannot do is jump into a try block or a catch handler. But &lt;br&gt; jumping out is OK and should do the clean-up. Part of 15/2 has: &lt;br&gt; &amp;quot;...A goto, break, return, or continue statement can be used to transfer &lt;br&gt; control out of &lt;br&gt; a try block or handler. When this happens, each variable declared in the
  </summary>
  </entry>
  <entry>
  <author>
  <name>Roman.Perepelitsa@gmail.com</name>
  <email>roman.perepeli...@gmail.com</email>
  </author>
  <updated>2009-11-20T21:10:54Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/3e6b726268e9588b/7a7753637b7fe79b?show_docid=7a7753637b7fe79b</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/3e6b726268e9588b/7a7753637b7fe79b?show_docid=7a7753637b7fe79b"/>
  <title type="text">Re: Article: On Iteration</title>
  <summary type="html" xml:space="preserve">
  On 11 Nov, 06:20, Andrei Alexandrescu &amp;lt;SeeWebsiteForEm...@erdani.org &amp;gt; &lt;br&gt; wrote: &lt;br&gt; Great article. A step-by-step introduction to the new concepts makes &lt;br&gt; it very easy to follow. &lt;br&gt; I have one question regarding infinite RandomAccessRange concept. &lt;br&gt; It has method &lt;br&gt; RandomAccessRange slice(int i, int j); &lt;br&gt; So it&#39;ll produce a finite range, right? Why there is no way to produce
  </summary>
  </entry>
  <entry>
  <author>
  <name>Goran</name>
  <email>goran.pu...@gmail.com</email>
  </author>
  <updated>2009-11-20T21:08:38Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/aea0d9b7bd90eaea/4dc6ffa2612d258d?show_docid=4dc6ffa2612d258d</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/aea0d9b7bd90eaea/4dc6ffa2612d258d?show_docid=4dc6ffa2612d258d"/>
  <title type="text">Re: Question on goto with try/catch</title>
  <summary type="html" xml:space="preserve">
  That does work correctly. In general: &lt;br&gt; { &lt;br&gt; TYPE var(params); &lt;br&gt; goto end; &lt;br&gt; end: &lt;br&gt; It does not matter whether a {} block is a &amp;quot;try&amp;quot; block or not, there &lt;br&gt; is no problem. It would have been horrible if goto broke automatic &lt;br&gt; object cleanup. &lt;br&gt; That said, authors did not know how to write C++. This is not &lt;br&gt; uncommon, especially for old code, or for stubborn C people. One
  </summary>
  </entry>
  <entry>
  <author>
  <name>Nick Hounsome</name>
  <email>nick.houns...@googlemail.com</email>
  </author>
  <updated>2009-11-20T21:09:47Z</updated>
  <id>http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/aea0d9b7bd90eaea/86e8c6e8f4dbf689?show_docid=86e8c6e8f4dbf689</id>
  <link href="http://groups.google.ca/group/comp.lang.c++.moderated/browse_thread/thread/aea0d9b7bd90eaea/86e8c6e8f4dbf689?show_docid=86e8c6e8f4dbf689"/>
  <title type="text">Re: Question on goto with try/catch</title>
  <summary type="html" xml:space="preserve">
  If the &amp;quot;bad thing&amp;quot; really is an exception then by all means throw an &lt;br&gt; exception. &lt;br&gt; No more and no less than leaving any other block by goto or even &lt;br&gt; return. &lt;br&gt; As far as the goto goes it is fine. &lt;br&gt; Destructors for anything declared in the try block are called on exit &lt;br&gt; however and whereever you exit the block.
  </summary>
  </entry>
</feed>
