Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Change not to propagate allocator.#253

Merged
KIwabuchi merged 5 commits intodevelopfromfeature/donot_propagate_allocator
Nov 12, 2022

Conversation

KIwabuchi
Copy link
Member

@KIwabuchiKIwabuchi commentedNov 8, 2022
edited
Loading

This PR setspropagate_on* types in thestl_allocator class tostd::false_type, as same as Boost.Interprocess.

This PR will change the behaviors of the STL containers when they are copy assigned, move assigned, or swapped between different Metall managers.

auto *manager0 =new metall::manager(metall::create_only,"/tmp/dir0");auto *manager1 =new metall::manager(metall::create_only,"/tmp/dir1");auto *vec0 = manager0->construct<vector_t>(metall::anonymous_instance)(manager0->get_allocator());vec0->push_back(10);auto *vec1 = manager1->construct<vector_t>(metall::anonymous_instance)(manager1->get_allocator());// This PR affects the behaviors of the following three operations:// 1. copy assignment*vec1 = *vec0;// 2. move assignment// However, copy will be performed instead of move.*vec1 = std::move(*vec0);// 3. swap// !! This operation does work anymoreusing std::swap;swap(*vec1, *vec0);// Can close the manager0 here which allocated vec0// because the allocator in vec0 is not propagated to vec1,// i.e., vec1 does not access memory resources in manager0.delete manager0;for (constauto &v: *vec1) {  std::cout << v << std::endl;}

@KIwabuchiKIwabuchi merged commite2473fe intodevelopNov 12, 2022
@KIwabuchiKIwabuchi deleted the feature/donot_propagate_allocator branchNovember 12, 2022 00:54
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@KIwabuchi

[8]ページ先頭

©2009-2025 Movatter.jp