Flow 2.0.0
Flow project: Public API.
Public Member Functions | List of all members
flow::util::Noncopyable Struct Reference

Useful as a no-unique-address private member to make a type noncopyable while keeping that type an aggregate (can be direct-initialized). More...

#include <util.hpp>

Public Member Functions

 Noncopyable ()=default
 Makes it possible to instantiate.
 
 Noncopyable (const Noncopyable &)=delete
 Forbid copying.
 
void operator= (const Noncopyable &)=delete
 Forbid copying.
 

Detailed Description

Useful as a no-unique-address private member to make a type noncopyable while keeping that type an aggregate (can be direct-initialized).

So you can do: [[no_unique_address]] flow::util::Noncopyable m_nc{};.

Rationale

The usual technique of deriving from boost::noncopyable disables aggregateness. In C++20 declaring a = delete copy ctor also disables it. This trick still works though.


The documentation for this struct was generated from the following file: