microsoft / microsoft/STL

LWG-2839 Self-move-assignment of library types, again

Open
#1,485 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

LWG
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

LWG-2839 "Self-move-assignment of library types, again" clarifies that move-assigning most Standard Library types to themselves leaves the object in a valid-but-unspecified state. While we are fairly fastidious about handling self-move and self-swap correctly when authoring new types, I'm not sure that our predecessors paid as much attention. We need to audit all of the move assignment operators in the STL to ensure that self-move leaves the class in a valid state except when the standard explicitly specifies otherwise.

Headers to Audit

  • <algorithm>
  • <any>
  • <array>
  • <atomic>
  • <barrier>
  • <bit>
  • <bitset>
  • <charconv>
  • <chrono>
  • <codecvt>
  • <compare>
  • <complex>
  • <concepts>
  • <condition_variable>
  • <coroutine>
  • <deque>
  • <exception>
  • <execution>
  • <expected>
  • <filesystem>
  • <flat_map> (not yet implemented in main)
  • <flat_set> (not yet implemented in main)
  • <format>
  • <forward_list>
  • <fstream>
  • <functional>
  • <future>
  • <generator> (not yet implemented in main)
  • <initializer_list>
  • <iomanip>
  • <ios>
  • <iosfwd>
  • <iostream>
  • <istream>
  • <iterator>
  • <latch>
  • <limits>
  • <list>
  • <locale>
  • <map>
  • <mdspan>
  • <memory>
  • <memory_resource>
  • <mutex>
  • <new>
  • <numbers>
  • <numeric>
  • <optional>
  • <ostream>
  • <print>
  • <queue>
  • <random>
  • <ranges>
  • <ratio>
  • <regex>
  • <scoped_allocator>
  • <semaphore>
  • <set>
  • <shared_mutex>
  • <source_location>
  • <span>
  • <spanstream>
  • <sstream>
  • <stack>
  • <stacktrace>
  • <stdexcept>
  • <stdfloat>
  • <stop_token>
  • <streambuf>
  • <string>
  • <string_view>
  • <strstream>
  • <syncstream>
  • <system_error>
  • <thread>
  • <tuple>
  • <type_traits>
  • <typeindex>
  • <typeinfo>
  • <unordered_map>
  • <unordered_set>
  • <utility>
  • <valarray>
  • <variant>
  • <vector>
  • <version>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by auditing the move-assignment operators in the listed STL headers against LWG-2839, skipping headers the issue identifies as not yet implemented in main. Done means each applicable library type has been checked and self-move leaves it valid, except where the standard explicitly allows otherwise.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.