[support.srcloc.class.general]

# 17 Language support library [[support]](./#support)

## 17.8 Source location [[support.srcloc]](support.srcloc#class.general)

### 17.8.2 Class source_location [[support.srcloc.class]](support.srcloc.class#general)

#### 17.8.2.1 General [support.srcloc.class.general]

[ð](#lib:source_location)

namespace std {struct source_location {// source location constructionstatic consteval source_location current() noexcept; constexpr source_location() noexcept; // source location field accessconstexpr uint_least32_t line() const noexcept; constexpr uint_least32_t column() const noexcept; constexpr const char* file_name() const noexcept; constexpr const char* function_name() const noexcept; private: uint_least32_t line_; // *exposition only* uint_least32_t column_; // *exposition only*const char* file_name_; // *exposition only*const char* function_name_; // *exposition only*};}

[1](#1)

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

The type source_location meets the[*Cpp17DefaultConstructible*](utility.arg.requirements#:Cpp17DefaultConstructible "16.4.4.2 Template argument requirements [utility.arg.requirements]"),[*Cpp17CopyConstructible*](utility.arg.requirements#:Cpp17CopyConstructible "16.4.4.2 Template argument requirements [utility.arg.requirements]"),[*Cpp17CopyAssignable*](utility.arg.requirements#:Cpp17CopyAssignable "16.4.4.2 Template argument requirements [utility.arg.requirements]"),[*Cpp17Swappable*](swappable.requirements#:Cpp17Swappable "16.4.4.3 Swappable requirements [swappable.requirements]"), and[*Cpp17Destructible*](utility.arg.requirements#:Cpp17Destructible "16.4.4.2 Template argument requirements [utility.arg.requirements]") requirements ([[utility.arg.requirements]](utility.arg.requirements "16.4.4.2 Template argument requirements"), [[swappable.requirements]](swappable.requirements "16.4.4.3 Swappable requirements"))[.](#1.sentence-1)

All of the following conditions are true:

- [(1.1)](#1.1)

is_nothrow_move_constructible_v<source_location>

- [(1.2)](#1.2)

is_nothrow_move_assignable_v<source_location>

- [(1.3)](#1.3)

is_nothrow_swappable_v<source_location>

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

The intent of source_location is
to have a small size and efficient copying[.](#1.sentence-2)

It is unspecified
whether the copy/move constructors and the copy/move assignment operators
are trivial and/or constexpr[.](#1.sentence-3)

â *end note*]

[2](#2)

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

The data members file_name_ and function_name_ always each refer to an ntbs[.](#2.sentence-1)

[3](#3)

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

The copy/move constructors and the copy/move assignment operators ofsource_location meet the following postconditions:
Given two objects lhs and rhs of type source_location,
where lhs is a copy/move result of rhs, and
where rhs_p is a value denoting the state of rhs before the corresponding copy/move operation,
then each of the following conditions is true:

- [(3.1)](#3.1)

strcmp(lhs.file_name(), rhs_p.file_name()) == 0

- [(3.2)](#3.2)

strcmp(lhs.function_name(), rhs_p.function_name()) == 0

- [(3.3)](#3.3)

lhs.line() == rhs_p.line()

- [(3.4)](#3.4)

lhs.column() == rhs_p.column()
