Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

043 memory_allocatorがdo_allocateを2回オーバーライド #129

Closed
Tan90909090 opened this issue Oct 27, 2017 · 1 comment
Closed

043 memory_allocatorがdo_allocateを2回オーバーライド #129

Tan90909090 opened this issue Oct 27, 2017 · 1 comment

Comments

@Tan90909090
Copy link
Contributor

標準ライブラリのメモリーリソースのサンプルで定義しているmemory_allocator中で、do_allocateを2回オーバーライドしています。

    virtual void * 
    do_allocate( std::size_t bytes, std::size_t alignment ) override
    {
        std::scoped_lock lock( m ) ; 
        // リンクリストをたどり、十分な大きさの未使用領域を探し、リンクリスト構造体を構築して返す
        // アライメント要求に注意
    }

    virtual void * 
    do_allocate( std::size_t bytes, std::size_t alignment ) override
    {
        std::scoped_lock lock( m ) ;
        // リンクリストから該当する部分を削除
    }

後者はdo_deallocateのオーバーライドではないでしょうか。

@EzoeRyou
Copy link
Owner

直した。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants