boostorg / boostorg/container

Bug(?): small_vector ignores stored_size

Open
#341 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
127
Forks
126
Avg merge
18h 53m
Merged PRs (30d)
1

Description

Hello, `small_vector` seems to be ignoring `stored_size` option, and instead always using `size_t`. Reading documentation, it seems to me that this should not be the case. Am I missing something or is this a bug? Thank you for your time.

(tested on 1.91 release (GCC 16.1), based on changelog and github issues, this wasn't changed for 1.92)
**minimal reproducible example:**

```
#include
#include
#include
#include

using namespace boost::container;

int main()
{
using vo = vector_options_t>;
using svo_16 = small_vector_options_t>;
using svo_32 = small_vector_options_t>;
using svo_64 = small_vector_options_t>;

// Expected sizeof(v1) == 16;
vector v1;
// Expected sizeof(v2) == 16;
small_vector v2;
// Expected sizeof(v3) == 24;
small_vector v3;
// Expected sizeof(v4) == 32;
small_vector v4;

std::cout << sizeof(decltype(v1)) << "\n"; // OK Returns 16
std::cout << sizeof(decltype(v2)) << "\n"; // ERROR(?) Returns 32, expected 16
std::cout << sizeof(decltype(v3)) << "\n"; // ERROR(?) Returns 32, expected 24
std::cout << sizeof(decltype(v4)) << "\n"; // OK Returns 32
}
```

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.