Comments (1)
I bumped into a version of this problem that's reproducible on GCC trunk
#include <utility>
#include <boost/container/flat_map.hpp>
namespace bc = boost::container;
int main() {
bc::flat_map<int, int> map {
std::pair(0, 1),
std::pair(1, 2),
std::pair(2, 4)
};
if (map.size() != 3) {
return 1;
}
int i = 0;
for (const auto &[k, v] : map) {
++i;
}
if (i != 3) {
return 2;
}
return 0;
}
When this is compiled with -O1
it runs as expected: i == 3
and the exit status is 0.
When compiled with -DBOOST_CONTAINER_DISABLE_FORCEINLINE -O2
the loop gets optimized away, i == 0
and the exit status is 2.
Here's a Compiler Explorer link showing the result: https://godbolt.org/z/7W5eGrKGE
Built with g++ (Compiler-Explorer-Build-gcc-181917d56c0cf4b8c1174a492a8157f4a12d1100-binutils-2.40) 14.0.0 20231219 (experimental)
from container.
Related Issues (20)
- Incompatible pointer types warning when building with Visual Studio Clang HOT 1
- Unreachable code
- flat_map slow insertion introduced in boost-1.80.0 HOT 1
- Deque should support node `extract` and `insert` a la `std::map` (since C++17) HOT 4
- Custom container leads to "invalid use of incomplete type" for "struct boost::container::dtl::container_rebind"
- KeyNodeCompare default constructor requirement HOT 2
- Construct flat associative containers from underlying sequence_type
- C++20 std::erase_if
- unrecognized command-line option β-fno-limit-debug-infoβ HOT 1
- hash_value overloads can probably be removed now
- Add "piece tree" container
- Feature request: Make `static_vector` "trivially relocatable" when possible HOT 3
- Global variables HOT 1
- Support for VM based allocators/container storage
- End iterators are not dereferencable
- Ability to choose static_vector's size_type
- dtl vs std pair HOT 1
- Compiler specific header bug HOT 1
- small_vector<T> is misaligned on the stack in 32 bits HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from container.