Meeting 11 July 2019

Elements of Programming Authors' Edition (free ebook)

http://componentsprogramming.com/elements-of-programming-authors-edition/

https://www.reddit.com/r/cpp/comments/c6fjjg/elements_of_programming_authors_edition/

Alex Stepanov and Paul McJones have just released Elements of Programming Authors’ Edition.

PDF download:

http://elementsofprogramming.com/

C++17 - The Complete Guide by Nicolai Josuttis

https://leanpub.com/cpp17

CLion 2019.2 EAP: MSVC Debugger, Unused Includes Check, and More

https://blog.jetbrains.com/clion/2019/06/clion-2019-2-eap-msvc-debugger-unused-includes-check-and-more/

  • Experimental feature: LLDB-based Debugger for the Microsoft Visual C++ toolchain
  • The ‘unused includes’ check is back
  • Memory view: ASCII view
  • Better performance for code completion

https://www.reddit.com/r/cpp/comments/c5vnhw/clion_20192_eap_brings_experimental_lldbbased/

Serenity OS Patterns: The Badge

(aka The Client-Attorney Idiom)

https://awesomekling.github.io/Serenity-C++-patterns-The-Badge/

template<typename T>
class Key { friend T; Key(){} Key(Key const&){} };
class Foo;
class Bar { public: void special(int a, Key<Foo>); }; // protected API
class Foo { public: void special() { Bar().special(1, {}); } };

// At call site
Foo().special();      // OK
Bar().special(1, {}); // Error: Key<Foo> ctor is private

Catching use-after-move bugs with Clang's consumed annotations

Article by Andreas Kling | Reddit

class [[clang::consumable(unconsumed)]] CleverObject {
public:
  CleverObject() {}
  CleverObject(CleverObject&& other) { other.invalidate(); }
  [[clang::callable_when(unconsumed)]]
  void do_something() { assert(m_valid); }
private:
  [[clang::set_typestate(consumed)]]
  void invalidate() { m_valid = false; }
  bool m_valid { true };
};

The Power of Hidden Friends in C++

Article by Anthony Williams

https://www.justsoftwaresolutions.co.uk/cplusplus/hidden-friends.html

namespace A{
  class X{
  public:
    X(int i):data(i){}
  private:
    int data;
    friend bool operator==(X const& lhs,X const& rhs){
      return lhs.data==rhs.data;
    }
  };
}

How to try the new coroutines TS?

https://www.reddit.com/r/cpp/comments/c6ag3l/how_to_try_the_new_coroutines_ts/

MSVC

/await /std:c++latest

Clang

-std=c++2a -stdlib=libc++ -fcoroutines-ts

Discussion: member variable naming

https://www.reddit.com/r/cpp/comments/c6rnel/discussion_member_variable_naming/

  • m_foo
  • foo_
  • _foo

Twitter

/img/beethoven.png