Debian Codegraph @

libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t.pass.cpp

raw
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 // <memory>
10
11 // shared_ptr(nullptr_t)
12
13 #include <memory>
14 #include <cassert>
15
16 #include "test_macros.h"
17
18 int main(int, char**)
19 {
20 {
21 std::shared_ptr<int> p(nullptr);
22 assert(p.use_count() == 0);
23 assert(p.get() == 0);
24 }
25
26 {
27 std::shared_ptr<int const> p(nullptr);
28 assert(p.use_count() == 0);
29 assert(p.get() == 0);
30 }
31
32 return 0;
33 }