boostorg / boostorg/type_traits

is_trivially_copyable doesn't follow the standard's definition

Open
#144 2 comments 0 reactions 1 assignee Claimed by @glenfe View on GitHub
Dominant language
C++
Stars
66
Forks
87
PR merge metrics
No merged PRs in 30d

Description

```cpp
#include
#include

struct foo {
foo(foo const&) = delete; // deleted copy constructor
foo& operator=(foo const&) = default;
};

struct bar {
bar(bar const&) = default;
bar(bar &&) {} // user defined move constructor
auto operator=(bar const&) -> bar& = default;
auto operator=(bar && ) -> bar& { return *this; } // user defined move assignment
};

static_assert(not boost::is_trivially_copyable::value);
static_assert( std ::is_trivially_copyable::value);

static_assert( boost::is_trivially_copyable::value);
static_assert(not std ::is_trivially_copyable::value);
```

https://en.cppreference.com/w/cpp/named_req/TriviallyCopyable
types with deleted constructors/move assignment operators are allowed to be trivially copyable, as long as at least one of them is defined, and all the non deleted ones are trivial.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.