[concept.assignable]

# 18 Concepts library [[concepts]](./#concepts)

## 18.4 Language-related concepts [[concepts.lang]](concepts.lang#concept.assignable)

### 18.4.8 Concept assignable_from [concept.assignable]

[ð](#concept:assignable_from)

`template<class LHS, class RHS>
  concept [assignable_from](#concept:assignable_from "18.4.8 Concept assignable_­from [concept.assignable]") =
    is_lvalue_reference_v<LHS> &&
    [common_reference_with](concept.commonref#concept:common_reference_with "18.4.5 Concept common_­reference_­with [concept.commonref]")<const remove_reference_t<LHS>&, const remove_reference_t<RHS>&> &&
    requires(LHS lhs, RHS&& rhs) {
      { lhs = std::forward<RHS>(rhs) } -> [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<LHS>;
    };
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/concepts.tex#L528)

Let:

- [(1.1)](#1.1)

lhs be an lvalue that refers to an object lcopy such that decltype((lhs)) is LHS,

- [(1.2)](#1.2)

rhs be an expression such that decltype((rhs)) is RHS, and

- [(1.3)](#1.3)

rcopy be a distinct object that is equal to rhs[.](#1.sentence-1)

LHS and RHS model[assignable_from](#concept:assignable_from "18.4.8 Concept assignable_­from [concept.assignable]")<LHS, RHS> only if

- [(1.4)](#1.4)

  addressof(lhs = rhs) == addressof(lcopy)[.](#1.4.sentence-1)

- [(1.5)](#1.5)

  After evaluating lhs = rhs:
  * [(1.5.1)](#1.5.1)

      lhs is equal to rcopy, unless rhs is a non-const
xvalue that refers to lcopy[.](#1.5.1.sentence-1)

  * [(1.5.2)](#1.5.2)

      If rhs is a non-const xvalue, the resulting state of the
object to which it refers is valid but unspecified ([[lib.types.movedfrom]](lib.types.movedfrom "16.4.6.17 Moved-from state of library types"))[.](#1.5.2.sentence-1)

  * [(1.5.3)](#1.5.3)

      Otherwise, if rhs is a glvalue, the object to which it refers is
 not modified[.](#1.5.3.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/concepts.tex#L555)

[*Note [1](#note-1)*:

Assignment need not be a total function ([[structure.requirements]](structure.requirements "16.3.2.3 Requirements"));
in particular, if assignment to an object x can result in a modification
of some other object y, then x = y is likely not in the domain
of =[.](#2.sentence-1)

â *end note*]
