The Obvious Final Step -- Andrzej Krzemieński

During the construction of an XML file when you write an element, it is obvious that the last thing that you do is to write the closing tag. By obvious we mean: writing it down adds no new information (there is no other possible final instruction for this task), and it would be a bug if this instruction wasn’t there.

The Obvious Final Step

by Andrzej Krzemieński

From the article:

The title may be misleading, as I had to invent a new short term for the pattern that occurs in the code once in a while. Example first:

// write an element of an XML file

xml.begin_element("port");
xml.attribute("name", name);
xml.attribute("location", loc);
xml.end_element("port");  // <-- the obvious final step

Defining Interfaces in C++: Concepts Versus Inheritance -- Daniel Lemire

DanielLemire.pngIn a previous blog post, Daniel Lemire showed how you could define ‘an interface’ in C++ using concepts and stated that he did not take into account inheritance as a strategy. He does so here.

Defining Interfaces in C++: Concepts Versus Inheritance

by Daniel Lemire

From the article:

In a previous blog post, I showed how you could define ‘an interface’ in C++ using concepts. For example, I can specify that a type should have the methods has_next, next and reset:

template <typename T>
concept is_iterable = requires(T v) {
                        { v.has_next() } -> std::convertible_to<bool>;
                        { v.next() } -> std::same_as<uint32_t>;
                        { v.reset() };
                      };

CppCon 2022 Dependency Injection for Modern C++ -- Tyler Weaver

Cpp22-Weaver.pngRegistration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2023!

Lightning Talk: Dependency Injection for Modern C++

by Tyler Weaver

Summary of the talk:

DI is a fancy OO term with an even more complex set of tooling to solve a problem that higher order functions solve in a nicer way. In this talk I'll demonstrate using std::function for dependency injection and talk about how taking functions as a parameter is nicer and more first class in C++ than inheritance or complex mocking libraries.

Basic HTTP and WebSocket Programming with Boost.Beast -- Richard Thomson

Utah C++ Programmers has released a new video:

Basic HTTP and WebSocket Programming with Boost.Beast

by Richard Thomson

From the video description:

Boost.Beast is a C++ header-only library serving as a foundation for writing interoperable networking libraries by providing low-level HTTP/1, WebSocket, and networking protocol vocabulary types and algorithms using the consistent asynchronous model of Boost.Asio.

This month, Richard Thomson will give us an introduction to Beast and the facilities it provides for HTTP and WebSocket applications. We will look at an example of implementing a REST API for a simple CRUD (Create, Read, Update, Delete) style database. We will revisit the comic book database example we have used in previous REST API presentations.

https://www.youtube.com/watch?v=gVmwrnhkybk

The Case of string_view and the Magic String -- Giovanni Dicanio

Someone learned about std::string_view, and started replacing instances of std::string const& with string_views in their C++ code base. As a result of that, a subtle bug shows up!

The Case of string_view and the Magic String

by Giovanni Dicanio

From the article:

(...) The code is recompiled and executed. But, unfortunately, now the output has changed! What’s going on here? Where does that “magic string” come from?

Sign Up for the free Pure Virtual C++ 2023 Conference -- Sy Brand

PureVirtualC++.pngEvery year we run Pure Virtual C++: a free one-day virtual conference for the whole C++ community. Next month we’re doing it again! Sign-up for free to get access to our five live sessions and a host of pre-conference content.

Sign Up for the free Pure Virtual C++ 2023 Conference

by Sy Brand

From the article:

The live event will run June 6th 13:00-16:00 UTC. Videos will be available to stream for free on YouTube after the conference.

The live sessions will be:

  • C++ Compiler Errors for Humans with Sy Brand
  • Address Sanitizer continue_on_error with Jim Radigan
  • Value-Oriented Programming with Tony Van Eerd
  • Productive Cross-Platform and Game Development in Visual Studio with Sinem Akinci and David Li
  • Build Time Reflection with C++ in Year 2023 with Gabriel Dos Reis

 

Defining Interfaces in C++ with ‘Concepts’ (C++20) -- Daniel Lemire

In an earlier blog post, I showed that the Go programming language allows you to write generic functions once you have defined an interface.

Defining Interfaces in C++ with ‘Concepts’ (C++20)

by Daniel Lemire

From the article:

Java has a very similar concept under the same name (interface). I gave the following example:


	type IntIterable interface {

	    HasNext() bool

	    Next() uint32

	    Reset()

	}

	

	func Count(i IntIterable) (count int) {

	    count = 0

	    i.Reset()

	    for i.HasNext() {

	        i.Next()

	        count++

	    }

	    return

	}

CppCon 2023 Call for Submissions -- Daisy Hollman

From the CppCon.org website:

CppCon 2023 Call for Submissions

Posted on   by Daisy Hollman

CppCon is the annual, week-long (October 1st-6th, 2023) face-to-face gathering for the entire C++ community. The conference Main Program consists of five days of several concurrent tracks of sixty-minute sessions.

This conference is organized by the C++ Community for the C++ Community. We want the whole community to be represented. We especially encourage those who identify as coming from an underrepresented community to apply to present and to be present. Presenting a talk is not limited to previous presenters or previous attendees.

This year’s edition of CppCon will be onsite at the Gaylord Rockies in Aurora, Colorado.

Have you learned something interesting about C++, maybe a new technique possible in C++17/20/23? Or perhaps you have implemented something cool, maybe a new C++ library? Or perhaps have an idea for a future language or library feature that you want to advocate for? If so, consider sharing it with other C++ enthusiasts by giving a Main Program talk at CppCon 2023.

In the past year there has been great interest in C++ “evolution” or “successor” languages. These are an important part of today’s C++ community, and so CppCon 2022 had well-received talks about Val and other such experiments. These talks are in scope for CppCon 2023, as long as they are of interest to C++ developers and tied to C++ evolution and are not primarily talks about rewriting entire C++ codebases in something other than C++. For example, a talk on How to migrate your C++ code to Haskell is off-topic and will not be considered, but a talk on What C++ Programmers Can Learn from Swift, or What Rust Procedural Macros Might Look Like in C++, or Results of Val/Carbon/Circle Experiments That Could Be Incorporated Into ISO C++ Evolution are on-topic and will be considered.

The submission deadline is June 25th, with decisions sent by July 31st.

To facilitate a double-blind review process, please avoid statements in your abstract that remove all uncertainty about who you are. See examples on the Submissions page.

We plan to have most (if not all) of the same tracks as last year, and we would like to add a few more. Each track will put out a call for submissions as we confirm their participation. If you plan to submit to a track, please indicate in your submission which track(s) you’d expect your talk to fit into. If you have new ideas for tracks or special interest areas to better serve the C++ community, please get in touch with the program committee directly with your thoughts.

For talk topic ideas, possible formats, submission instructions and valuable advice on how to make the best possible submission, see the Submissions page.

Note: Calls for Lightning Talks and Open Content sessions will be made later this summer. The deadline for these is the conference itself.

 

CppCon 2022 How to Win at Coding Interviews -- David Stone

Stone-codinginterviews.pngRegistration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2023!

Lightning Talk: How to Win at Coding Interviews

by David Stone

Summary of the talk:

5 minutes of preparation is plenty to beat any coding interview.

Consider Using constexpr Static Function Variables for Performance in C++ -- Daniel Lemire

When programming, we often need constant variables that are used within a single function.

Consider Using constexpr Static Function Variables for Performance in C++

by Daniel Lemire

From the article:

When programming, we often need constant variables that are used within a single function. For example, you may want to look up characters from a table. The following function is efficient:

char table(int idx) {
  const char array[] = {'z', 'b', 'k', 'd'};
  return array[idx];
}