Declaring the move constructor--Andrzej Krzemieński

An interesting question, with a proposed answer:

Declaring the move constructor

by Andrzej Krzemieński

From the article:

I am not satisfied with the solution I gave in the previous post. The proposed interface was this:


class Tool
{
private:
  ResourceA resA_;
  ResourceB resB_;
  // more resources
 
public:
  // Tools's interface
 
  Tool(Tool &&) = default;           // noexcept is deduced
  Tool& operator=(Tool&&) = default; // noexcept is deduced
 
  Tool(Tool const&) = delete;
  Tool& operator=(Tool const&) = delete;
};

static_assert(std::is_move_constructible<Tool>::value, "...");
static_assert(std::is_move_assignable<Tool>::value, "...");

In a way, it is self contradictory. The whole idea behind departing from the Rule of Zero is to separate the interface from the current implementation. Yet, as the comments indicate, the exception specification is deduced from the current implementation, and thus unstable...

CoderPower exclusive C++ Back to School Challenge

Summer is almost over, meaning it’s time to return to reality. To help you reconnect with coding and open a new season of series, CoderPower offers an exclusive opportunity to discover the innovative interface of the new HP all-in-one computer, the HP Sprout.

Untill Oct. 26th, you can get to know the Sprout SDK in an environment that will show you, step-by-step, how easy and fun coding on Sprout really is. 

Your mission: follow the three warm-ups made by the @CoderPower team, that will teach you how to return the SDK version number and to use the monitor GUID as well as the touch mat. Do the complementary exercises and level up your skills! Write, copy and paste your code in the panel on the right side of the screen. The technology is all along simulated by a mocking system that send you back an answer. If it is the correct one, well done! If not, use your super-coder abilities to spot your mistake and try again!

Then enter the weekly challenges, for examples: “Show the mat keyboard” or “Extract Outline”. For starters, 2 challenges will be released the two first weeks and one challenge per week until Oct. 26th. So you have to perform well in 10 challenges to be the best C++ coder!

The rules are easy: You have to code against the clock. Quicker you are, more points you get. Points are cumulative between challenges and at the end of the challenge, the contestant with the biggest score on the leaderboard will win a HP Sprout. Be aware that you can only take a challenge once! Do your best on the first try!

To get started, click here http://bit.ly/1KhxOw9

CppCon 2014 Embarcadero Case Study: Bringing CLANG/LLVM To Windows--John "JT" Thomas

Have you registered for CppCon 2015 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 2014 for you to enjoy. Here is today’s feature:

Embarcadero Case Study: Bringing CLANG/LLVM To Windows

by John "JT" Thomas

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

CLANG/LLVM delivers a highly conforming C++ compiler and architecture for targeting multiple CPUs, and, as such, has seen success in iOS and other operating systems. Embarcadero has successfully delivered the first commercial compiler for Windows based on CLANG/LLVM. This session describes the benefits of CLANG/LLVM as well as the challenges in bringing it to the Windows operating system. Particular emphasis is placed on the managing the changes in CLANG as well as the additional features added to enable Windows development.

CppCon 2015: More Lightning Talks -- Kate Gregory

cppcon-009.PNGReminder: The CppCon regular registration rate ends in 2 1/2 days! After that late registration will still be available.

CppCon 2015: More Lightning Talks

by Kate Gregory

From the announcement:

One of the big surprises last year at CppCon was the tremendous response to the lightning talks. People kept submitting them, and we just kept adding sessions. This year, we’re adding those sessions in advance as the submissions come in, so that you can plan to attend. (And yes, you can still submit a talk. We have time slots we can hold more lightning talk sessions in.) We’ve just added two more sessions – Tuesday lunch and Wednesday morning – to accommodate the submissions already received. You’ll see the lightning talk sessions in yellow on the program. The abstract is vague, and it’s not going to get less vague. You don’t know precisely what you’re going to get until you show up.

What roughly will you get? A number of different talks – some funny, some very technical, some personal, some inspirational, some that will make your grateful you have the job you do and not the speaker’s job. Some will be 5 minutes long and some 15 minutes long. A few might be followups to something that’s already happened. Others might be a way to invite you to something that hasn’t happened yet. Some will be the very first public speaking that speaker has ever done, and some will be a chance to let your hair down with a speaker you’ve seen being serious many times before. Some might not interest you, but that’s ok – they’re short, you can be bored for 5 or 15 minutes, and then there will be a different one. They’re little bite size goodies, and for many of us they were a very enjoyable highlight of the conference. Add some to your schedule now, and be prepared to get up a little early or stay on site a little late to get the full benefit of your time here!

Posted in News

CppCast Episode 26: Effective C++ with Scott Meyers

Episode 26 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Scott Meyers to discuss the Effective C++ book series.

CppCast Episode 26: Effective C++ with Scott Meyers

by Rob Irving and Jason Turner

About the interviewee:

Scott Meyers has been working with C++ since 1988. He’s the author of Effective C++, More Effective C++, Effective STL, and his most recent book, Effective Modern C++. For 25 years, he’s delivered C++ training to clients worldwide. He once lectured about C++ on a brass-railed nightclub stage while the audience sat at cocktail tables.

CppCon 2015 Program Highlights, 12 of N

The CppCon 2015 conference program has been posted for the upcoming September conference. We’ve received requests that the program continue to be posted in “bite-sized” posts, a few sessions at a time, to make the 100+ sessions easier to absorb, so here is another set of talks. This series of posts will conclude once the entire conference program has been posted in this way.

 

C++, it is also a language that we like to discover and master always more.

The following interrelated CppCon 2015 talks tackle these issues and more (part 3).

In this post:

  • Generic Lambdas from Scratch
  • Large Scale C++ With Modules: What You Should Know
  • Shared_Future from Scratch
  • Comparison is not simple, but it can be simpler
  • The Importance of Being const
  • Intro to the C++ Object Model

 

Generic Lambdas from Scratch by Arthur O'Dwyer, software engineer, Mixpanel

Lambdas (even those mysterious generic lambdas) are just syntactic sugar atop constructs that are perfectly understandable when approached from the right direction.

We'll start with the implementation of C-style functions, then move to overloading, function templates, non-static member functions, C++11 lambdas, and then demystify C++14 generic ("auto") lambdas. Finally, we'll detour into the implementations of std::function and std::bind to show how they're different from lambdas.


Large Scale C++ With Modules: What You Should Know by Gabriel Dos Reis, Principal Software Development Engineer, Microsoft

To be completed.


Shared_Future from Scratch by Arthur O'Dwyer, software engineer, Mixpanel

The contents of header are probably still a bit mysterious to most people. Sure, we know that setting the value of a promise causes the corresponding future to resolve; but how does that happen behind the scenes in a way that allows us to move futures around? How are we going to implement the new features in the Concurrency TS, such as .then() and .when_all()? How (if at all) do futures interact with std::thread, std::async, and "executors"?

We'll present an extremely simplified implementation of futures and shared_futures, without the template metaprogramming that comes along with future and future and so on, but showing all the pointers and synchronization primitives.


Comparison is not simple, but it can be simpler by Lawrence Crowl

The standard's algorithms typically require a 'strict weak ordering'. I will explain what this really means and show that even simple uses of sort can have latent failures. Programmers can avoid the problems today with a bit of work. Changes to the standard will reduce errors and programming effort.


The Importance of Being const by Richard Powell, Audio Software Engineer

Why do we use const? It helps the compiler enforce program invariants, find trivial bugs, and generally makes code better. But with C++11 has an extended meaning, specifically in regards to multi-threaded code.

This talk will be an intro to the const keyword and what it means to declare objects, pointers and member functions as const. We will also explore some subtle issues encountered with const, mutable, and multithreaded code.


Intro to the C++ Object Model by Richard Powell, Audio Software Engineer

This talk is to help you learn about how objects are represented in C++. I find it very helpful to have a mental model of how objects exist in the program memory space to understand how my code operates within program execution.