Calling inherited template constructor of unique_ptr subclass

后端 未结 1 1150
野的像风
野的像风 2021-01-22 14:25

This is not a duplicate of questions on template constructors or even on calling inherited template constructors.

It is specifically about calling the inherited construc

1条回答
  •  抹茶落季
    2021-01-22 15:13

    std::unique is meant to be smart pointer for ints, i.e. a replacement for int*.

    When you use std::unique, the pointer needs to be int**.

    Instead of

    using B = std::unique_ptr;
    

    use

    using B = std::unique_ptr;
    

    Working code (Thanks, @CompuChip): http://ideone.com/ul29vr.

    0 讨论(0)
提交回复
热议问题