Just C++ - dlib serialize & std::shared_ptr
New episode of Just C++, today on serializing shared_ptr with dlib
Just C++ - serializing dlib & std::shared_ptr
by Jens Weller
March 19-21, Madrid, Spain
April 1-4, Bristol, UK
June 16-21, Sofia, Bulgaria
By Meeting C++ | Sep 1, 2017 03:48 AM | Tags: experimental dlib basics
New episode of Just C++, today on serializing shared_ptr with dlib
Just C++ - serializing dlib & std::shared_ptr
by Jens Weller
By Marco Arena | Aug 31, 2017 08:16 AM | Tags: visual studio
Several Visual Studio extensions that can make your life better as a C++ developer:
Visual Studio extensions for C++ developers in Visual Studio 2017
by Adam Welch
From the article:
In this blogpost we want to highlight several Visual Studio extensions that can make your life better as a C++ developer if you’re using Visual Studio 2017 or considering upgrading...
By Meeting C++ | Aug 31, 2017 06:57 AM | Tags: None
New Just C++ episode, this time with an overview on dlib
Just C++ - dlib overview
by Jens Weller
By Jason Turner | Aug 30, 2017 01:23 PM | Tags: basics
Episode 78 of C++ Weekly.
Intro to CMake
by Jason Turner
About the show:
In this episode Jason gives an overview on how to use CMake for crossplatform C++ development.
By Adrien Hamelin | Aug 30, 2017 12:45 PM | Tags: intermediate c++11
Quick A: Use integer_sequence with a helper function.
Recently on SO:
Array Initialisation Compile Time - Constexpr Sequence
1) How to implement that kind of integer_sequence?
template <std::size_t... Is> constexpr auto make_sequence_impl(std::index_sequence<Is...>) { return std::index_sequence<generate_ith_number(Is)...>{}; } template <std::size_t N> constexpr auto make_sequence() { return make_sequence_impl(std::make_index_sequence<N>{}); }2) Is it possible to build an std::array from that integer_sequence at compile time?
template <std::size_t... Is> constexpr auto make_array_from_sequence_impl(std::index_sequence<Is...>) { return std::array<std::size_t, sizeof...(Is)>{Is...}; } template <typename Seq> constexpr auto make_array_from_sequence(Seq) { return make_array_from_sequence_impl(Seq{}); }Usage:
int main() { constexpr auto arr = make_array_from_sequence(make_sequence<6>()); static_assert(arr[0] == 0); static_assert(arr[1] == 1); static_assert(arr[2] == 2); static_assert(arr[3] == 4); static_assert(arr[4] == 5); static_assert(arr[5] == 7); }
By Adrien Hamelin | Aug 30, 2017 12:34 PM | Tags: None
Quick A: The constructor needs an extra {}
pair.
Recently on SO:
vector does not convert brace encloser list
You have two options:
- add a constructor taking
std::initializer_list<std::initializer_list<T>>
- eclose the init expression with another set of
{}
i.e.Matrix<double> a{{ { 17, 24, 1}, { 23, 5, 7 }, { 4, 6, 13 } }};Ok, I'll try a little explanation of what is going on here:
If there is no constructor taking a
std::initializer_list
then the outermost{}
are always opening and closing the constructor call if you will, and not part of what you actually pass to the constructor.Matrix<double> a{ {1, 2}, {3, 4} }; ^ ^~~~~~~~~~~~~~ ^ | 2 parameters | | | | | opening closingAs you can see this is taken as a constructor with 2 parameters, in this case 2
initializer_lists
.This is why you need another set of
{}
:Matrix<double> a{ {{1, 2}, {3, 4}} }; ^ ^~~~~~~~~~~~~~~~ ^ | 1 parameter | | | | | opening closingIn order for the outermost
{}
to be considered aninitializer_list
then the constructor needs to have an overload taking ainitializer_list
. That is what is happening in thestd::vector
case.
By Adrien Hamelin | Aug 30, 2017 12:29 PM | Tags: intermediate
Have you registered for CppCon 2017 in September? Don’t delay – Registration is open now.
While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2016 for you to enjoy. Here is today’s feature:
The Exception Situation
by Patrice Roy
Summary of the talk:
Exceptions have been a part of C++ for a long time now, and they are not going away. They allow programmers to concentrate on the meaningful parts of their code and treat the things that happen infrequently as… well, exceptional situations, to be dealt with when and where the context makes it reasonable or useful.
On the other hand, some significant parts of the C++ programming community either dislike this mechanism or outright reject it, for a number of reasons. Work in SG14 has raised performance issues in some cases; there are those who dislike the additional execution paths introduced in programs that rely on exceptions; some programmers raised issues with respect to exceptions and tooling, integration with older codebases, writing robust generic code, etc.
This talk will be neither for not against exceptions. It will present a perspective on cases where they make sense, cases where they are less appropriate, alternative disappointment handling techniques presented along with client code in order to show how the various approaches influence the way code is written. Performance measurements will be given along the way. Some creative uses of exceptions will also be presented in order to spark ideas and discussions in the room.
By Andrey Karpov | Aug 30, 2017 02:36 AM | Tags: tools static code analyzer pvs-studio devops
In this version there are improvements, which, in my opinion, deserve a small note.
Useful Improvements in the PVS-Studio 6.17 Release
by Andrey Karpov
From the article:
A much more interesting feature is that a mechanism of virtual values was significantly redesigned in the kernel of C++ analyzer. For example, now the analyzer performs a double loop passage, which allows it to define the range of possible values of variables, changing in a loop, more accurately. So don't be surprised if the analyzer starts issuing many warnings for that code which used to seem correct for the analyzer.
By Adrien Hamelin | Aug 29, 2017 12:57 PM | Tags: experimental community
Did you miss something?
C++ Annotated: Apr – Aug 2017
by Anastasia Kazakova
From the article:
Today we are happy to share our next compilation of C++ news with you.
By Adrien Hamelin | Aug 29, 2017 12:54 PM | Tags: community
Who wants to participate?
Calls for Lightning Talks and Open Content
From the article:
Less that 30 days out from CppCon 2017, regular session and poster submissions are closed, both of the field trip tours are sold out, and most of our official hotel blocks are either closed or sold out.
But, even now, there are still conference opportunities. There is still over two weeks left of regular registration, we are still accepting class registrations, we have rooms available in some of our official hotel blocks, and it isn’t too late to attend sessions for free by signing up as a volunteer.
To day we are also opening up two ways to present at the conference.