C++ Madrid: Distributed systems, ZeroMQ and Protobuffers Workshop
On Thursday the 26th of March at Tuenti's HQs in Madrid, Spain.
Sistemas Distribuidos con ZMQ y Google Protocol Buffers
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 3-8, Kona, HI, USA
By Jordi Mon Companys | Mar 9, 2015 01:58 AM | Tags: intermediate
On Thursday the 26th of March at Tuenti's HQs in Madrid, Spain.
Sistemas Distribuidos con ZMQ y Google Protocol Buffers
By Blog Staff | Mar 7, 2015 07:19 PM | Tags: None
From a totally unnecessary blog (we beg to differ):
Stackless coroutines with Visual Studio 2015
by Paolo Severini
From the article:
I had been looking for some time now at the problem of implementing coroutines/resumable functions in order to have even in C++ something similar to what is provided by C#
await
andyield
statements. It turns out that -- unbeknown to me -- this is quite a hot topic in the C++ community...... stackful coroutines have a big disadvantage in the fact that fibers are very expensive... The new proposal (N4286) instead focuses mostly on a stackless implementation, and promises to be scalable to billions of concurrent coroutines...
By Blog Staff | Mar 7, 2015 06:11 PM | Tags: None
Because clear example code is a great motivator:
A quick tour of the Silicon web framework: A simple blog API in 85 C++ lines
by Matthieu Garrigues
From the article:
In late January 2015, I released the first version of the Silicon Web Framework. The documentation covers all the concepts of the library but does not contains a concrete example covering the needs of a real world application. In this blog post, I'll show how to write a such an application with the framework. Like most modern web apps, it relies on a database to store data, and sessions to authenticate its users.
The source code of this article is hosted on the Silicon github repository: https://github.com/matt-42/silicon/blob/master/examples/blog_api.hh ...
By Blog Staff | Mar 7, 2015 06:06 PM | Tags: basics
Hot off kukuruku:
Secrets of the Conditional (ternary) Operator
by Alex Kulikov
(Note: Translation of the original Russian-language article here.)
From the article:
Every self-respecting C/C++ programmer knows what the ternary operator is, and most everyone used it at least once in their programs. But do you know all the secrets of the ternary operator? What potential dangers are associated with its use and what features, seemingly not related to its direct purpose, it has? This article gives you the opportunity to test your knowledge and maybe learn something new.
Let's start with a small test...
By Adrien Hamelin | Mar 6, 2015 11:21 AM | Tags: c++11 basics
Quick A: Because constexpr means can be evaluated at compile time, not that it will be. And it won’t be if the inputs aren’t compile-time constants.
Recently on SO:
I am confused about a constexpr function?
In C++ Primer, Fifth Edition, §6.5.2:
but another sentence in this chapter (page 239):A
constexpr
function is defined like any other function but must meet certain restrictions: The return type and the type of each parameter in must be a literal type (§2.4.4, p. 66), and the function body must contain exactly one return statementA constexpr function is permitted to return a value that is not a constant
// scale(arg) is a constant expression if arg is a constant expression constexpr size_t scale(size_t cnt) { return new_sz() * cnt; }Is it a contradictory summary? I am confused about it.
The return type ofscale
is literal type?
update: what's the difference between literal type and constant ?
By robwirving | Mar 6, 2015 10:06 AM | Tags: None
Episode 2 of CppCast, the only podcast by C++ developers for C++ developers. In this episode host Rob Irving interviews Jason Turner about ChaiScript and the benefits of taking your C++ application cross platform.
CppCast Episode 2: Jason Turner on ChaiScript and Cross Platform C++
by Rob Irving
About the interviewee:
Jason has been developing portable C++ since 2002. With very few exceptions, every line of code he has written since then has had to run on multiple platforms. He is an independent contractor focusing on cross-platform issues, utilization of C++ libraries from scripting languages and code quality assurance. He is the co-creator and maintainer of ChaiScript, a mature scripting language designed for modern C++. His latest project is cppbestpractices.com: a fledgling effort to gather the collective wisdom of the C++ community.
By Adrien Hamelin | Mar 6, 2015 08:00 AM | Tags: intermediate c++14
While we wait for CppCon 2015 in September, we’re featuring videos of some of the 100+ talks from CppCon 2014. Here is today’s feature:
The Philosophy of Google's C++ Code
by Titus Winters
Summary of the talk:
The Google C++ Style Guide is a fairly popular guide for C++ coding practices, both at Google and externally, but some of its recommendations often seem dated and have created controversy and perceived tension with more modern C++ In this talk we will focus on the core philosophies underlying that guide, ranging from the common (be consistent) to the unusual (leave an explicit trace for the reader), and debunk the idea that Google's C++ is anything less than modern. We'll discuss how these core ideas inform contentious rules like "No non-const references" and "Don't use exceptions," and how the application of those rules has worked for us in practice, both as developers and reliability engineers (SREs).
By Adrien Hamelin | Mar 5, 2015 10:44 AM | Tags: c++11 basics
Quick A: use an std::initializer_list
.
Recently on SO:
Writting variadic template constructor
Recently I asked this question but now I would like to expand it. I wrote the following class:
template <class T> class X{ public: vector<T> v; template <class T> X(T n) { v.push_back(n); } template <class T, class... T2> X(T n, T2... rest) { v.push_back(n); X(rest...); } };When creating and object using
X<int> obj(1, 2, 3); // obj.v containts only 1Vector only contains the first value, but not others. I've checked and saw that constructor is called 3 times, so I'm probably creating temp objects and filling their vectors with the rest of the arguments. How do I solve this problem?
By Adrien Hamelin | Mar 5, 2015 10:40 AM | Tags: c++11 basics
Quick A: Capture the tuple
by reference.
Recently on SO:
Modifying a tuple in a vector of tuples c++
I have a vector of tuples
vector<tuple<int,int>> vector;
and I want to modify one of the tuples it contains.for (std::tuple<int, int> tup : std::vector) { if (get<0>(tup) == k) { /* change get<1>(tup) to a new value * and have that change shown in the vector */ } }I am unsure how to change the value of the tuple and have the change be reflected in the vector. I have tried using
get<1>(tup) = v;but that doesn't change the value of the tuple that is in the vector. How can I do this? Thanks.
By Marcin Hoppe | Mar 5, 2015 01:56 AM | Tags: basics
Explicit C++ has posted a nice tutorial on how to implement an algorithm in C++.
How to write a standard-like algorithm
by Indi
from the article:
Writing a standard-like algorithm should be one of the key parts of a modern C++ beginner’s course outline. This post will be a whirlwind guide through the steps toward creating a standard-like algorithm. The focus is not on the algorithm itself, but on the process of creating one.