-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Keita Iwabuchi
committed
Feb 15, 2024
1 parent
881239a
commit 6b204d0
Showing
9 changed files
with
349 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// 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) | ||
|
||
#include <iostream> | ||
|
||
#include <metall/metall.hpp> | ||
#include <metall/container/vector.hpp> | ||
|
||
using vector_t = | ||
metall::container::vector<int, metall::manager::fallback_allocator<int>>; | ||
|
||
int main() { | ||
// Allocation using Metall | ||
{ | ||
metall::manager manager(metall::create_only, "/tmp/dir"); | ||
auto pvec = manager.construct<vector_t>("vec")(manager.get_allocator()); | ||
pvec->push_back(1); | ||
std::cout << (*pvec)[0] << std::endl; | ||
} | ||
|
||
// Allocation not using Metall, i.e., uses a heap allocator (malloc()). | ||
// This code would cause a build error if fallback_allocator were not used. | ||
{ | ||
vector_t vec; // As no metall allocator argument is passed, the fallback | ||
// allocator uses malloc() internally. | ||
vec.push_back(2); | ||
std::cout << vec[0] << std::endl; | ||
} | ||
|
||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.