Metall  v0.29
A persistent memory allocator for data-centric analytics
metall_containers.cpp

This is an example of how to use Metall containers.

// Copyright 2020 Lawrence Livermore National Security, LLC and other Metall
// Project Developers. See the top-level COPYRIGHT file for details.
//
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
// Boost 1.81 or later is required
#if BOOST_VERSION >= 108100
#endif
// Boost 1.82 or later is required
#if BOOST_VERSION >= 108200
#endif
using namespace metall;
namespace mc = metall::container;
int main() {
manager mg(create_only, "/tmp/dir");
auto *deque = mg.construct<mc::deque<int>>("deque")(mg.get_allocator());
mg.destroy_ptr(deque);
mg.construct<mc::list<int>>("list")(mg.get_allocator());
mg.construct<mc::map<int, int>>("map")(mg.get_allocator());
mg.construct<mc::multimap<int, int>>("mmap")(mg.get_allocator());
mg.construct<mc::set<int>>("set")(mg.get_allocator());
mg.construct<mc::multiset<int>>("multiset")(mg.get_allocator());
mg.construct<mc::unordered_map<int, int>>("unordered_map")(
mg.get_allocator());
mg.construct<mc::unordered_multimap<int, int>>("unordered_multimap")(
mg.get_allocator());
mg.construct<mc::unordered_set<int>>("unordered_set")(mg.get_allocator());
mg.construct<mc::unordered_multiset<int>>("unordered_multiset")(
mg.get_allocator());
#if BOOST_VERSION >= 108100
mg.construct<mc::unordered_flat_map<int, int>>("unordered_flat_map")(
mg.get_allocator());
mg.construct<mc::unordered_flat_set<int>>("unordered_flat_set")(
mg.get_allocator());
#endif
#if BOOST_VERSION >= 108200
mg.construct<mc::unordered_node_map<int, int>>("unordered_node_map")(
mg.get_allocator());
mg.construct<mc::unordered_node_set<int>>("unordered_node_set")(
mg.get_allocator());
#endif
mg.construct<mc::vector<int>>("vector")(mg.get_allocator());
mg.construct<mc::stack<int>>("stack")(mg.get_allocator());
mg.construct<mc::queue<int>>("queue")(mg.get_allocator());
mg.construct<mc::priority_queue<int>>("priority_queue")(mg.get_allocator());
mg.construct<mc::string>("string")(mg.get_allocator());
mg.construct<mc::wstring>("wstring")(mg.get_allocator());
using innger_set = mc::set<int>;
using vec_of_sets =
mg.construct<vec_of_sets>("vec-sets")(mg.get_allocator());
return 0;
}
int main()
Definition: jgraph.cpp:24
Namespace for Metall container.
boost::container::deque< T, Allocator > deque
A deque container that uses Metall as its default allocator.
Definition: deque.hpp:17
boost::container::multiset< Key, Compare, Allocator > multiset
A multiset container that uses Metall as its default allocator.
Definition: set.hpp:25
std::priority_queue< T, Container > priority_queue
A priority_queue container that uses Metall as its default allocator.
Definition: priority_queue.hpp:19
boost::unordered_node_set< Key, Hash, KeyEqual, Allocator > unordered_node_set
An unordered_node_set container that uses Metall as its default allocator.
Definition: unordered_node_set.hpp:24
std::stack< T, Container > stack
A stack container that uses Metall as its default allocator.
Definition: stack.hpp:17
basic_string< char > string
A string container that uses char as its character type and Metall as its default allocator.
Definition: string.hpp:23
boost::unordered_flat_set< Key, Hash, KeyEqual, Allocator > unordered_flat_set
An unordered_flat_set container that uses Metall as its default allocator.
Definition: unordered_flat_set.hpp:24
boost::unordered_flat_map< Key, T, Hash, KeyEqual, Allocator > unordered_flat_map
An unordered_flat_map container that uses Metall as its default allocator.
Definition: unordered_flat_map.hpp:24
basic_string< wchar_t > wstring
A string container that uses wchar_t as its character type and Metall as its default allocator.
Definition: string.hpp:27
boost::unordered_set< Key, Hash, KeyEqual, Allocator > unordered_set
An unordered_set container that uses Metall as its default allocator.
Definition: unordered_set.hpp:21
boost::container::set< Key, Compare, Allocator > set
A set container that uses Metall as its default allocator.
Definition: set.hpp:20
boost::container::vector< T, Allocator > vector
A vector container that uses Metall as its default allocator.
Definition: vector.hpp:17
boost::unordered_multiset< Key, Hash, KeyEqual, Allocator > unordered_multiset
An unordered_multiset container that uses Metall as its default allocator.
Definition: unordered_set.hpp:29
std::queue< T, Container > queue
A queue container that uses Metall as its default allocator.
Definition: queue.hpp:17
boost::container::map< Key, T, Compare, Allocator > map
A map container that uses Metall as its default allocator.
Definition: map.hpp:20
boost::unordered_map< Key, T, Hash, KeyEqual, Allocator > unordered_map
An unordered_map container that uses Metall as its default allocator.
Definition: unordered_map.hpp:21
boost::container::multimap< Key, T, Compare, Allocator > multimap
A multimap container that uses Metall as its default allocator.
Definition: map.hpp:25
boost::unordered_multimap< Key, T, Hash, KeyEqual, Allocator > unordered_multimap
An unordered_multimap container that uses Metall as its default allocator.
Definition: unordered_map.hpp:29
boost::container::list< T, Allocator > list
A list container that uses Metall as its default allocator.
Definition: list.hpp:17
boost::unordered_node_map< Key, T, Hash, KeyEqual, Allocator > unordered_node_map
An unordered_node_map container that uses Metall as its default allocator.
Definition: unordered_node_map.hpp:24
The top level of namespace of Metall.
Definition: basic_manager.hpp:22
basic_manager<> manager
Default Metall manager class which is an alias of basic_manager with the default template parameters.
Definition: metall.hpp:34