33 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <memory>10 11// shared_ptr12 13// T* operator->() const;14 15#include <memory>16#include <utility>17#include <cassert>18 19#include "test_macros.h"20 21int main(int, char**)22{23 const std::shared_ptr<std::pair<int, int> > p(new std::pair<int, int>(3, 4));24 assert(p->first == 3);25 assert(p->second == 4);26 p->first = 5;27 p->second = 6;28 assert(p->first == 5);29 assert(p->second == 6);30 31 return 0;32}33