bool_type.h 967 B

1234567891011121314151617181920212223242526
  1. #ifndef NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
  2. #define NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
  3. #if defined(_MSC_VER) || \
  4. (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
  5. (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
  6. #pragma once
  7. #endif
  8. namespace YAML {
  9. namespace detail {
  10. struct unspecified_bool {
  11. struct NOT_ALLOWED;
  12. static void true_value(NOT_ALLOWED*) {}
  13. };
  14. typedef void (*unspecified_bool_type)(unspecified_bool::NOT_ALLOWED*);
  15. }
  16. }
  17. #define YAML_CPP_OPERATOR_BOOL() \
  18. operator YAML::detail::unspecified_bool_type() const { \
  19. return this->operator!() ? 0 \
  20. : &YAML::detail::unspecified_bool::true_value; \
  21. }
  22. #endif // NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66