Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 768 Bytes

File metadata and controls

17 lines (14 loc) · 768 Bytes
title C26406
ms.date 07/21/2017
ms.topic conceptual
f1_keywords
C26406
helpviewer_keywords
C26406
ms.assetid 02fb8e23-1989-4e24-a5a5-e30f71d00325

C26406 DONT_ASSIGN_RAW_TO_OWNER

Owners are initialized from allocations or from other owners. Assigning a value from a raw pointer to an owner pointer is not allowed. Raw pointers don’t guarantee ownership transfer; there is still may be an original owner which holds the resource and will attempt to release it. Note that assigning a value from owner to a raw pointer is fine; raw pointers are valid clients to access resources, but not to manage them.

Example 1: Using address of object

gsl::owner<Socket*> socket = defaultSocket ? &defaultSocket : new Socket(); // C26406