# std::experimental::atomic_weak_ptr<T>::load

> C++ Atlas: `cppatlas.com/w/cpp/experimental/atomic_weak_ptr/load` | Source: https://en.cppreference.com/w/cpp/experimental/atomic_weak_ptr/load | Domain: Technical specifications | Standards: C++20, C++26

Atomically loads and returns the current value of the atomic_weak_ptr. Memory is affected according to the value of order.

## Official Specification Summary (cppreference)

```cpp
weak_ptr<T> load( std::memory_order order = std::memory_order_seq_cst ) const noexcept;
```

Atomically loads and returns the current value of the `atomic_weak_ptr`. Memory is affected according to the value of `order`.

`order` must be one of `std::memory_order_relaxed`, `std::memory_order_consume`, `std::memory_order_acquire` or `std::memory_order_seq_cst`. Otherwise the behavior is undefined.

### Parameters

- `order` - memory order constraints to enforce

### Remarks

All associated `use_count` increments are guaranteed to be performed as part of the atomic operation.

### Return value

The current value of the `atomic_weak_ptr`.

### See also

- [`operator weak_ptr<T>`](https://en.cppreference.com/w/cpp/experimental/atomic_weak_ptr/operator_weak_ptr): loads a value from an atomic object (public member function)
- [`std::atomic_is_lock_free(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic) (deprecated in C++20), [`std::atomic_load(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic) (removed in C++26), [`std::atomic_load_explicit(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic), [`std::atomic_store(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic), [`std::atomic_store_explicit(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic), [`std::atomic_exchange(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic), [`std::atomic_exchange_explicit(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic), [`std::atomic_compare_exchange_weak(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic), [`std::atomic_compare_exchange_strong(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic), [`std::atomic_compare_exchange_weak_explicit(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic), [`std::atomic_compare_exchange_strong_explicit(std::shared_ptr)`](https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic): specializes atomic operations for `std::shared_ptr` (function template)

---
Attribution: content from https://en.cppreference.com/w/cpp/experimental/atomic_weak_ptr/load (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.