Meeting 15 February 2018

C++ in 2018, by Jens Weller, Meeting C++

Post

Overload #143

ACCU, PDF

Book: Better Code: Goals for Software Developers, by Sean Parent

Preorder on Amazon

Released 19 May 2018.

StackOverflow: int in C++

StackOverflow: Scope of a variable initialized in the parameter list of a function

Question

emBO++: Embedded C++ Conference in Bochum, Germany

Home page

Insomniac Games C++ Coding Standard (2011)

GistReddit

  • 2-space indents, no tabs
  • No exceptions
  • Constructors shouldn’t do any real work, the real initialization is done in Create() or TryCreate()
  • Destructors are empty, all deinitialization is done in Destroy()
  • Integer scalars are signed
  • No enum data members (size is implementation-specific)
  • Output parameters are pointers, not references (“References can be confusing”)
  • Function parameter order: output, update, input
  • Use C-style casts. Do not use C++-style casts (“The brevity of the C-style cast outweighs the semantic benefits of explicitness of C++-style casts”)
  • Under no circumstances should the keyword mutable be used

JUCE C++ Coding Standard

Link

  • 4 spaces, no tabs, Allman-style braces
  • Space before opening parens func (foo, bar)
  • Avoid underscores in names (except macros)
  • Don’t use macros
  • Avoid C-style casts
  • Pass small types by value

The 15 C++11 features you must really use in your C++ projects

Article

CppCon 2016: David Sankel - Variants: Past, Present, and Future

1void output(const std::variant<std::string, int>& v) {
2    return std::visit(std::overload(
3        [](const std::string& s) {std::cout << "String: " << s << "\n";},
4        [](const int i) {std::cout << "Integer: " << i << "\n";}), v);
5}

Mach7: A pattern-matching library for C++, by Yuriy Solodkyy, Gabriel Dos Reis, Bjarne Stroustrup

 1void print(const boost::variant<double,float,int>& v)
 2{
 3    var<double> d; var<float> f; var<int> n;
 4    Match(v)
 5    {
 6        Case(C<double>(d)) cout << "double " << d << endl; break;
 7        Case(C<float> (f)) cout << "float  " << f << endl; break;
 8        Case(C<int>   (n)) cout << "int    " << n << endl; break;
 9    }
10    EndMatch
11}

C++Now 2017: Vittorio Romeo - Implementing variant visitation using lambdas

This is trivial. Is this clear to everyone? Silence

 1enum MyVariant {
 2    IntTag(i32),
 3    FloatTag(f32),
 4    DoubleTag(f64)
 5}
 6
 7let v0 = FloatTag(2.0);
 8match v0 {
 9    IntTag(x)    => println!("{}i", x),
10    FloatTag(x)  => println!("{}f", x),
11    DoubleTag(x) => println!("{}d", x)
12}
1using shape = std::variant<circle, box>;
2shape s0{circle{/*...*/}};
3shape s1{box{/*...*/}};
4
5// In place `match` visitation.
6scelta::match([](circle, circle){ /* ... */ },
7              [](circle, box)   { /* ... */ },
8              [](box,    circle){ /* ... */ },
9              [](box,    box)   { /* ... */ })(s0, s1);

CppCon 2015: John R. Bandela - Simple, Extensible Pattern Matching in C++14

  • simple_match (C++14), no macros, focus on clarity and simplicity (not speed)
  • GitHub

Jens Weller - Programming in a different domain - Meeting C++ 2017

Computers Biology


Byte: 8 bits Byte: 3 ‘bits’ Bit: 0 or 1 ‘Bit’: (G or C) or (T or A) C++ Assembler + punch tape

Programming life? New cures? Growing things? A new Clang target?

Verdigris: Qt without MOC, v1.0

Selene: A C++14 image representation, processing and I/O library

  • GitHub (MIT)
  • Offers flexible classes for image and multi-channel pixel representations, and functions for image data access.
  • Provides easy-to-use APIs to read and write images in JPEG and PNG formats (leveraging libjpeg and libpng).
  • Offers basic image processing algorithms such as color conversions, pixel-wise operations, rotation, flipping, etc.
  • Lightweight and easy to build using CMake on Linux, MacOS, Windows.

Vc: SIMD Vector Classes for C++ by Matthias Kretz

libbson: A BSON utility library by MongoDB

TscanCode: Static analyser for C++, C#, Lua

GitHub

Transwarp: A header-only C++ library for task concurrency

GitHub