HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Optional.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * RELATION TO THE STL:
7  *
8  * Use the wrapper UT_Optional instead of std::optional for consistent style
9  *
10  * Reasoning:
11  *
12  * This used to be hboost::optional prior to C++17
13  */
14 
15 #pragma once
16 
17 #ifndef __UT_OPTIONAL_H_INCLUDED__
18 #define __UT_OPTIONAL_H_INCLUDED__
19 
20 #include <SYS/SYS_TypeDecorate.h>
21 #include <optional>
22 
23 #define UT_NULLOPT std::nullopt
24 
25 template <typename T>
26 using UT_Optional = std::optional<T>;
27 
28 #define UTmakeOptional std::make_optional
29 
30 //
31 // Declare relocation traits. See SYS_TypeDecorate.h
32 //
33 
34 // Guaranteed safe for trivial relocation:
35 template <typename T>
36 struct SafeTrivialRelocationNoCV< UT_Optional< T > > : SafeTrivialRelocationNoCV< SYS_RemoveCV_t< T > > {};
37 
38 // Known to be unsafe for trivial relocation:
39 template <typename T>
40 struct UnsafeTrivialRelocationNoCV< UT_Optional< T > > : UnsafeTrivialRelocationNoCV< SYS_RemoveCV_t< T > > {};
41 
42 
43 #endif
std::optional< T > UT_Optional
Definition: UT_Optional.h:26