C++

Livecoding

February 23, 2016 C++, News No comments

Yay, it has been a while.

Sadly there is still nothing new on the slugbay front. But back to topic.

Today I had my first live coding session at livecoding.tv.

After some startup problems I got it working and finally finished the documentation for my DI container I wrote half a year ago. So there was not much coding today… more documenting. Though it had to be done 🙂 I also found some issues I intent to fix in the following days.

The project source can be found on GitHub.

Future plans are to implement a bigger project live and maybe also do some tutorials (see how that works out^^).

echo

January 12, 2016 C++ No comments

Well hello to my first post in here.

This is basically a test post to see how Markdown, the syntax highlighter etc. work together.

Anyways, here is a little example code taking its command line arguments and printing them out again using iterator based standard algorithms.

#include <algorithm>
#include <iostream>
#include <iterator>

int main(int argc, char ** argv)
{
    std::copy(
        argv + 1,
        argv + argc,
        std::ostream_iterator<char *>(std::cout, " ")
    );
    return 0;
}

One could also just do it like this:

#include <iostream>

int main(int argc, char ** argv)
{
    for (int n = 1; n < argc - 1; ++n)
        std::cout << argv[n] << " ";
    if (argc > 1)
        std::cout << argv[argc - 1];
    return 0;
}

Yet this does not look as nice. The argc - 1 and the if (argc > 1) were neccassary so there would not be a trailing whitespace at the end of the output.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close