optional is "is_copy_constructible" when T is not.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start with the Godbolt reproducer and the boost/optional.hpp header, then trace how boost::optional determines its copy-constructibility. Compare that result with std::optional for a type whose copy constructor is deleted but move operations are available. Done means the final static assertion passes, with regression coverage added if the repository provides a relevant test location.
Written by the indexing model from the issue text.
Description
Hi.
I encountered issues while trying to use std::vector<boost::optional<std::tuple<NonCopyable, std::function<...>>>. THis failed to compile on msvc.
Looks like it boiled down to this repro: https://godbolt.org/g/cFNcUN
#include <boost/optional.hpp>
#include <type_traits>
#include <optional>
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<NonCopyAble>::value, "NonCopyAble is_copy_constructible when shouldn't be");
static_assert(!std::is_copy_constructible<std::optional<NonCopyAble>>::value, "std::optional<NonCopyAble> is_copy_constructible when shouldn't be");
static_assert(!std::is_copy_constructible<boost::optional<NonCopyAble>>::value, "boost::optional<NonCopyAble> is_copy_constructible when shouldn't be"); // This assert fails
- Dominant language
- C++
- Stars
- 60
- Forks
- 75
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/optional
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
CMake tests fail Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
All issues in boostorg/optional
Similar issues
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 88/100
QuantStack/git2cpp#187 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100