Strong types for strong interfaces - Jonathan Boccara
A talk on Strong Types from Meeting C++ 2017!
Strong types for strong interfaces
by Jonathan Boccara
March 11-13, Online
March 16-18, Madrid, Spain
March 23-28, Croydon, London, UK
March 30, Kortrijk, Belgium
May 4-8, Aspen, CO, USA
May 4-8, Toronto, Canada
June 8 to 13, Brno, Czechia
June 17-20, Folkestone, UK
September 12-18, Aurora, CO, USA
November 6-8, Berlin, Germany
November 16-21, Búzios, Rio De Janeiro, Brazil
By Meeting C++ | Jan 24, 2018 02:03 AM | Tags: strong types meetingcpp intermediate basics
A talk on Strong Types from Meeting C++ 2017!
Strong types for strong interfaces
by Jonathan Boccara
By Marco Arena | Jan 22, 2018 09:47 AM | Tags: visual studio basics
Visual Studio 2017 15.6 Preview 2 includes a set of updates to the C++ Core Guidelines Check extension:
C++ Core Check in Visual Studio 2017 15.6 Preview 2
by Sergiy Oryekhov
From the article:
We added more checks to help with the effort of making code cleaner, more secure and maintainable. This document is a quick overview of the new rules...
By Meeting C++ | Jan 20, 2018 10:10 AM | Tags: tmp templates template meta programming meetingcpp basics
A new talk from Meeting C++ 2017
An inspiring introduction into Template Meta Programming
by Milosz Warzecha
By Meeting C++ | Jan 19, 2018 10:21 AM | Tags: python programming meetingcpp intermediate haskell experimental efficiency basics
A new video from Meeting C++ 2017:
Improve your C++ with Inspirations from other languages
by Andreas Reischuck
By Meeting C++ | Jan 10, 2018 03:05 AM | Tags: meetingcpp lightningtalks basics
The 3rd and last part of lightning talks at Meeting C++ 2017
function_ref
by Vittorio Romeo
A variant of recursive decent parsing
by Björn Fahller
A quick view into a compiler
by Arvid Gerstmann
Algorithms and Iterators for Multidimensional Arrays
by Cem Bassoy
A short story about configuration file formats
by Andreas Rein
By Adrien Hamelin | Jan 8, 2018 11:32 AM | Tags: basics
Quick A: Do not confuse mathematical concepts with C++ terminology.
Recently on SO:
Confused about vectors
You are getting confused because the mathematical concept of a vector can mean a "collection of data" and that is what you were taught int v[10] was. The actual name for that in C++ (and most other languages) is an "array" not a vector.
The libraries referred to in C++ Primer have a class called "vector" which is an implementation of an array. They are similar, but not the same.
I hope that clears that up a bit. You are probably confused because you were taught that int v[10] is a vector, but it is "not really" in C++. It's an array. Use that term to refer to it. If you ever refer to it as a vector, you will confuse others and yourself.
By Meeting C++ | Dec 28, 2017 04:54 AM | Tags: meetingcpp embedded basics
The video of the closing keynote from Meeting C++ 2017 is online:
Embedded & C++ - Meeting C++ 2017 Keynote
by Wouter van Ooijen
By Meeting C++ | Dec 23, 2017 06:39 AM | Tags: meetingcpp keynote intermediate efficiency community basics
The first keynote from Meeting C++ 2017 has been published:
Kate Gregory - It's Complicated - Meeting C++ 2017 Center Keynote
by Kate Gregory
By bfilipek | Dec 6, 2017 10:51 AM | Tags: basics
Examples where unique_ptr shines:
5 ways how unique_ptr enhances resource safety in your code
by Bartlomiej Filipek
From the article:
While shared_ptr and weak_ptr are more complex, unique_ptr seems to be a perfect replacement for owning raw pointers. Not to mention is the fact that this pointer type is mostly a compile time “wrapper” and it cost almost nothing in the runtime.
By Adrien Hamelin | Nov 9, 2017 02:46 PM | Tags: basics
Quick A: It tell the compiler not to do any implicit conversions of types.
Recnetly on SO:
What does the explicit keyword mean?
The compiler is allowed to make one implicit conversion to resolve the parameters to a function. What this means is that the compiler can use constructors callable with a single parameter to convert from one type to another in order to get the right type for a parameter.
Here's an example class with a constructor that can be used for implicit conversions:
class Foo { public: // single parameter constructor, can be used as an implicit conversion Foo (int foo) : m_foo (foo) { } int GetFoo () { return m_foo; } private: int m_foo; };Here's a simple function that takes a Foo object:
void DoBar (Foo foo) { int i = foo.GetFoo (); }and here's where the DoBar function is called.
int main () { DoBar (42); }The argument is not a Foo object, but an int. However, there exists a constructor for Foo that takes an int so this constructor can be used to convert the parameter to the correct type.
The compiler is allowed to do this once for each parameter.
Prefixing the explicit keyword to the constructor prevents the compiler from using that constructor for implicit conversions. Adding it to the above class will create a compiler error at the function call DoBar (42). It is now necessary to call for conversion explicitly with DoBar (Foo (42))
The reason you might want to do this is to avoid accidental construction that can hide bugs. Contrived example:
- You have a MyString(int size) class with a constructor that constructs a string of the given size. You have a function print(const MyString&), and you call print(3) (when you actually intended to call print("3")). You expect it to print "3", but it prints an empty string of length 3 instead.