Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
84809112
Commit
84809112
authored
Oct 02, 2019
by
Andy Maloney
Committed by
Jesse Beder
Oct 02, 2019
Browse files
Replace node's YAML_CPP_OPERATOR_BOOL macro with an explicit bool operator (#755)
parent
6e87b370
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
28 deletions
+1
-28
include/yaml-cpp/node/detail/bool_type.h
include/yaml-cpp/node/detail/bool_type.h
+0
-26
include/yaml-cpp/node/node.h
include/yaml-cpp/node/node.h
+1
-2
No files found.
include/yaml-cpp/node/detail/bool_type.h
deleted
100644 → 0
View file @
6e87b370
#ifndef NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#if defined(_MSC_VER) || \
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
namespace
YAML
{
namespace
detail
{
struct
unspecified_bool
{
struct
NOT_ALLOWED
;
static
void
true_value
(
NOT_ALLOWED
*
)
{}
};
using
unspecified_bool_type
=
void
(
*
)(
unspecified_bool
::
NOT_ALLOWED
*
);
}
}
#define YAML_CPP_OPERATOR_BOOL() \
operator YAML::detail::unspecified_bool_type() const { \
return this->operator!() ? 0 \
: &YAML::detail::unspecified_bool::true_value; \
}
#endif // NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
include/yaml-cpp/node/node.h
View file @
84809112
...
...
@@ -13,7 +13,6 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/emitterstyle.h"
#include "yaml-cpp/mark.h"
#include "yaml-cpp/node/detail/bool_type.h"
#include "yaml-cpp/node/detail/iterator_fwd.h"
#include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/type.h"
...
...
@@ -59,7 +58,7 @@ class YAML_CPP_API Node {
bool
IsMap
()
const
{
return
Type
()
==
NodeType
::
Map
;
}
// bool conversions
YAML_CPP_OPERATOR_BOOL
()
explicit
operator
bool
()
const
{
return
IsDefined
();
}
bool
operator
!
()
const
{
return
!
IsDefined
();
}
// access
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment