|
|
|
1 |
|
/*** |
2 |
|
*safebool.h - types and constants for implementing the "smart bool" idiom. |
3 |
|
* |
4 |
|
* Copyright (c) Microsoft Corporation. All rights reserved. |
5 |
|
* |
6 |
|
*Purpose: Prefer _safe_bool to an implicit conversion to bool. When a |
7 |
|
* type is implicitly convertible to bool, it is also implicitly |
8 |
|
* convertible to any integral type, and this is often not |
9 |
|
* desired. Instead, provide a conversion to _safe_bool, which |
10 |
|
* is really a pointer to a member function on a dummy struct. |
11 |
|
* This pointer can be evaluated in Boolean context, but it will |
12 |
|
* never be converted to an integral type. |
13 |
|
* |
14 |
|
* [Public] |
15 |
|
* |
16 |
|
****/ |
17 |
|
|
18 |
|
#pragma once |
19 |
|
|
20 |
|
#if !defined(_INC_MSCLR_SAFEBOOL) |
21 |
|
|
22 |
|
#ifndef __cplusplus_cli |
23 |
|
#error ERROR: msclr libraries are not compatible with /clr:oldSyntax |
24 |
|
#endif |
25 |
|
|
26 |
|
namespace msclr |
27 |
|
{ |
28 |
|
|