高级会员

- 威望
- 252
- 贡献
- 216
- 热心值
- 0
- 金币
- 186
- 注册时间
- 2020-10-1
|
#include <iostream>
#include <memory>
#include <type_traits>
struct C
{
C(int i) : i(i) {} //< constructor needed (until C++20)
int i;
};
int main()
{
auto sp = std::make_shared<C>(12);
static_assert(std::is_same_v<decltype(sp), std::shared_ptr<C>>);
std::cout << sp->i << '\n';
} |
|