Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 1.52 KB

requirements-for-stl-clr-container-elements.md

File metadata and controls

32 lines (26 loc) · 1.52 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
Requirements for STL/CLR Container Elements | Microsoft Docs
11/04/2016
cpp-windows
reference
C++
C++ Standard Library, template class containers
STL/CLR, containers
containers, STL/CLR
containers, C++ Standard Library
59ab240c-15bf-4701-a9f9-e7c56e5ab53f
8
mikeblome
mblome
ghogen

Requirements for STL/CLR Container Elements

All reference types that are inserted into STL/CLR containers must have, at a minimum, the following elements:

  • A public copy constructor.

  • A public assignment operator.

  • A public destructor.

Furthermore, associative containers such as set and map must have a public comparison operator defined, which is operator< by default. Some operations on containers might also require a public default constructor and a public equivalence operator to be defined.

Like reference types, value types and handles to reference types that are to be inserted into an associative container must have a comparison operator such as operator< defined. The requirements for a public copy constructor, public assignment operator, and a public destructor do not exist for value types or handles to reference types.

See Also

C++ Standard Library Reference