Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand in-place tags page #4753

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
description: "Learn more about: in_place_t Struct, in_place_type_t Struct, in_place_index_t Struct"
title: "in_place_t Struct, in_place_type_t Struct, in_place_index_t Struct"
ms.date: "11/04/2016"
f1_keywords: ["utility<in_place_t>", "utility/std::in_place_t", "utility<in_place_type_t>", "utility/std::in_place_type_t", "utility<in_place_index_t>", "utility/std::in_place_index_t"]
helpviewer_keywords: ["utility<in_place_t> struct"]
---
# in_place_t Struct, in_place_type_t Struct, in_place_index_t Struct
Copy link
Collaborator

@TylerMSFT TylerMSFT Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please code escape. Otherwise, auto machine translation may have modify these


The empty structure type `in_place_t` can be passed into constructors of `expected` class, [`optional` class](optional-class.md) or [`single_view` class](single-view-class.md) for in-place construction of the contained type. The empty structure type `in_place_type_t` can be passed into constructors of [`any` class](any-class.md) or [`variant` class](variant-class.md) to specify the type of the object. The empty structure type `in_place_index_t` can be passed into constructors of [`variant` class](variant-class.md) to specify the index of the object.
Copy link
Collaborator

@TylerMSFT TylerMSFT Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weren't these introduced in C++17? We should tag them as such and indicate that they should use at least /std:c++17 to compile. I realize that the topic you started from was lame in this regard.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says where we can pass them, but not why.
The ISO spec in section 20.2.7 has some explanation that would be good to make readable and add to the remarks.


## Syntax

```cpp
struct in_place_t {
explicit in_place_t() = default;
};

inline constexpr in_place_t in_place{};

template <class T>
struct in_place_type_t {
explicit in_place_type_t() = default;
};

template <class T>
inline constexpr in_place_type_t<T> in_place_type{};

template <size_t I>
struct in_place_index_t {
explicit in_place_index_t() = default;
};

template <size_t I>
inline constexpr in_place_index_t<I> in_place_index{};
```
32 changes: 0 additions & 32 deletions docs/standard-library/in-place-t-struct.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/standard-library/optional-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The class template `optional<T>` describes an object that may or may not contain

When an instance of `optional<T>` contains a value, the contained value is allocated within the storage of the `optional` object, in a region suitably aligned for type `T`. When an `optional<T>` is converted to **`bool`**, the result is **`true`** if the object contains a value; otherwise, it's **`false`**.

The contained object type `T` must not be [in_place_t](in-place-t-struct.md) or [nullopt_t](nullopt-t-structure.md). `T` must be *destructible*, that is, its destructor must reclaim all owned resources, and may throw no exceptions.
The contained object type `T` must not be [in_place_t](in-place-t-struct-in-place-type-t-struct-in-place-index-t-struct.md) or [nullopt_t](nullopt-t-structure.md). `T` must be *destructible*, that is, its destructor must reclaim all owned resources, and may throw no exceptions.

The `optional` class is new in C++17.

Expand Down
2 changes: 1 addition & 1 deletion docs/standard-library/utility.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Pairs are widely used in the C++ Standard Library. They are required both as the
|-|-|
|[from_chars_result](../standard-library/from-chars-result-structure.md)|A struct used for `from_chars`.|
|[identity](../standard-library/identity-structure.md)|A struct that provides a type definition as the template parameter.|
|[in_place_t](../standard-library/in-place-t-struct.md)|Also includes structs `in_place_type_t` and `in_place_index_t`.|
|[in_place_t, in_place_type_t, in_place_index_t](../standard-library/in-place-t-struct-in-place-type-t-struct-in-place-index-t-struct.md)|Types used to control in-place construction.|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please code escape. I know that this file hasn't been doing that. Many of these were written before we realized what was going on with machine translation, so when we touch a file we code escape functions, types, etc.

|[integer_sequence](../standard-library/integer-sequence-class.md)|Represents an integer sequence.|
|[pair](../standard-library/pair-structure.md)|A type that provides for the ability to treat two objects as a single object.|
|[piecewise_construct_t](../standard-library/piecewise-construct-t-structure.md)|A type used to keep separate constructor and function overloading.|
Expand Down