facebook / facebook/folly

Question about usage of std::aligned_storage in small_vector

Open
#1,446 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
30.5k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

I noticed in the code base for `small_vector<...>` that `std::aligned_storage<...>` is used. According to the documentation on [cppreference](https://en.cppreference.com/w/cpp/types/aligned_storage), `std::aligned_storage<...>` should be used with trivial standard layout types. I was wondering if the usage of `std::aligned_storage<...>` in `small_vector<...>` is conformant to the rules in the aforementioned link. I realize this is more of a question than an "issue", but I was curious as to if this has any risks of undefined behavior and if not why?

Thanks.

Contributor guide

Open the contributing guide

Research direction

Start by reading the small_vector implementation and the linked cppreference documentation for std::aligned_storage. Determine whether its use is conformant and document any undefined-behavior risks and the rationale for the current usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.