Ticket #11190: attribute_value_set.cpp

File attribute_value_set.cpp, 961 bytes (added by Jonathan Jones <jonathan.jones@…>, 8 years ago)

Reproduction program

Line 
1#undef NDEBUG
2#include <boost/log/attributes/attribute_set.hpp>
3#include <boost/log/attributes/attribute_value_set.hpp>
4#include <boost/log/attributes/constant.hpp>
5
6int main()
7{
8 boost::log::attribute_set set;
9 for (auto ch='A'; ch <= 'z'; ++ch)
10 {
11 auto const key(std::string("key") + ch);
12 auto const res(set.insert(key, boost::log::attributes::make_constant(5)));
13 assert(res.second); // insertion succeeded
14 assert(set.find(res.first->first) != set.end()); // and so did find
15 for (auto const item: set)
16 {
17 // This issue has been fixed.
18 assert(set.find(item.first) != set.end());
19 }
20 }
21
22 boost::log::attribute_set thread, global;
23 boost::log::attribute_value_set vset(set, thread, global);
24 for (auto const item: vset)
25 {
26 // But this one remains.
27 assert(vset.find(item.first) != vset.end());
28 }
29 return 0;
30}