boostorg / boostorg/optional

optional is "is_copy_constructible" when T is not.

Open
#54 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
60
Forks
75
PR merge metrics
No merged PRs in 30d

Description

Hi.
I encountered issues while trying to use std::vector>>. THis failed to compile on msvc.

Looks like it boiled down to this repro: https://godbolt.org/g/cFNcUN

```
#include
#include
#include

struct NonCopyAble
{
NonCopyAble() = default;

NonCopyAble(const NonCopyAble&) = delete;
NonCopyAble& operator=(const NonCopyAble&) = delete;

NonCopyAble(NonCopyAble&&) = default;
NonCopyAble& operator=(NonCopyAble&&) = default;
};

static_assert(!std::is_copy_constructible::value, "NonCopyAble is_copy_constructible when shouldn't be");
static_assert(!std::is_copy_constructible>::value, "std::optional is_copy_constructible when shouldn't be");
static_assert(!std::is_copy_constructible>::value, "boost::optional is_copy_constructible when shouldn't be"); // This assert fails
```

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.