File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //
2+ // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
3+ //
4+ // Distributed under the Boost Software License, Version 1.0. (See accompanying
5+ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+ //
7+ // Official repository: https://github.com/cppalliance/rts
8+ //
9+
10+ #ifndef BOOST_RTS_DATASTORE_HPP
11+ #define BOOST_RTS_DATASTORE_HPP
12+
13+ #include < boost/rts/detail/config.hpp>
14+ #include < boost/rts/polystore.hpp>
15+
16+ namespace boost {
17+ namespace rts {
18+
19+ class datastore : public polystore
20+ {
21+ public:
22+ datastore () = default ;
23+
24+ void clear () noexcept
25+ {
26+ polystore::clear ();
27+ }
28+ };
29+
30+ } // rts
31+ } // boost
32+
33+ #endif
Original file line number Diff line number Diff line change @@ -181,15 +181,6 @@ class polystore
181181 */
182182 polystore () = default ;
183183
184- /* * Remove and destroy all objects in the container.
185-
186- All stored objects are destroyed in the reverse order
187- of construction. The container is left empty.
188- */
189- BOOST_RTS_DECL
190- void
191- clear () noexcept ;
192-
193184 /* * Return a pointer to the object associated with type `T`, or `nullptr`
194185
195186 If no object associated with `T` exists in the container,
@@ -499,6 +490,22 @@ class polystore
499490 struct any ;
500491 class elements ;
501492
493+ /* * Remove and destroy all objects in the container.
494+
495+ All stored objects are destroyed in the reverse order
496+ of construction. The container is left empty.
497+ */
498+ BOOST_RTS_DECL
499+ void
500+ clear () noexcept ;
501+
502+ /* * Return a range of all stored elements
503+ @par Thread Safety
504+ `const` member function calls are thread-safe.
505+ Calls to non-`const` member functions must not run concurrently
506+ with other member functions on the same object.
507+ @return An object representing the range of stored elements.
508+ */
502509 BOOST_RTS_DECL
503510 elements
504511 get_elements () noexcept ;
Original file line number Diff line number Diff line change 1+ //
2+ // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
3+ //
4+ // Distributed under the Boost Software License, Version 1.0. (See accompanying
5+ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+ //
7+ // Official repository: https://github.com/cppalliance/rts
8+ //
9+
10+ #include < boost/rts/datastore.hpp>
11+ #include < utility>
12+
13+ namespace boost {
14+ namespace rts {
15+
16+ } // rts
17+ } // boost
Original file line number Diff line number Diff line change 1+ //
2+ // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
3+ //
4+ // Distributed under the Boost Software License, Version 1.0. (See accompanying
5+ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+ //
7+ // Official repository: https://github.com/cppalliance/rts
8+ //
9+
10+ // Test that header file is self-contained.
11+ #include < boost/rts/datastore.hpp>
12+
13+ #include " test_suite.hpp"
14+
15+ namespace boost {
16+ namespace rts {
17+
18+ struct datastore_test
19+ {
20+ void run ()
21+ {
22+ struct T {};
23+
24+ datastore ds;
25+ BOOST_TEST_EQ ( ds.find <T>(), nullptr );
26+ BOOST_TEST_NO_THROW ( ds.emplace <T>() );
27+ BOOST_TEST_NE ( ds.find <T>(), nullptr );
28+ ds.clear ();
29+ BOOST_TEST_EQ ( ds.find <T>(), nullptr );
30+ }
31+ };
32+
33+ TEST_SUITE (datastore_test, " boost.rts.datastore" );
34+
35+ } // rts
36+ } // boost
You can’t perform that action at this time.
0 commit comments