Pass by iterator is not a new concept, but one that we are going to perhaps give a new name to today and propose as a standard for normal usage.
If you take for example the normal way of passing around standard containers:
// Print a vector of strings separated by spaces.
void print(const std::vector<std::string> &t_vector)
{
for(std::vector<std::string>::const_iterator itr = t_vector.begin();
itr != t_vector.end();
++itr)
{
std::cout << *itr << " ";
}
}
std::vector<std::string> m_vec;
m_vec.push_back("Hello");
m_vec.push_back("World");
print(m_vec);The idea of "Pass By Iterator" that we are proposing involves never again writing code like the above.
We've now completed 5 articles in the "Nobody Understands C++" series so here we are going to recap the misconceptions we have covered.
On occasion you will read or hear someone talking about C++ templates causing code bloat. I was thinking about it the other day and thought to myself, "self, if the code does exactly the same thing then the compiled code cannot really be any bigger, can it?"
Here are the test cases presented, first without the use of templates, second with the use of templates. Exactly the same functionality and exactly the same code output:
For those who do not know, most random number generation on a computer is accomplished via a pseudo-random sequence generator. A random number generator takes a seed value and generates a sequence of numbers from that value. If you provide the same seed, you get the same sequence. Often times the programmer will seed the random number generator with the current time of day, adding some variability to the output.
I recently shut down my source.emptycrate.com website which was used for Christian open source project hosting. This was due to several factors but the single event that caused me to shut it down when I did was a server problem with my old host.
I've since moved to a new host which does not allow me the flexibility to run a source control server, so shutting down the website was a necessity. That is, without spending more money and effort than I was willing to move to a service that would continue to allow me to run the source site.
The results of the 7 hour challenge have been posted the google code project page.
Recent comments
3 days 20 hours ago
3 days 22 hours ago
3 days 22 hours ago
6 days 23 hours ago
1 week 5 min ago
1 week 3 days ago
2 weeks 3 days ago
5 weeks 3 days ago
7 weeks 55 min ago
8 weeks 2 days ago