mirror of
https://github.com/PDB-REDO/libcifpp.git
synced 2026-06-04 13:54:25 +08:00
remove operator bool for item's. The result is too ambiguous.
This commit is contained in:
@@ -255,23 +255,6 @@ class item_value
|
||||
/// Return the type of the contained value
|
||||
[[nodiscard]] constexpr item_value_type type() const { return m_data.m_type; }
|
||||
|
||||
/// Depending on the type, return true if the value is considered to be 'true'
|
||||
explicit operator bool() const noexcept
|
||||
{
|
||||
bool result = false;
|
||||
switch (m_data.m_type)
|
||||
{
|
||||
using enum item_value_type;
|
||||
|
||||
case INT: result = m_data.m_value.m_integer != 0; break;
|
||||
case FLOAT: result = m_data.m_value.m_float != 0; break;
|
||||
case TEXT: result = m_data.m_len != 0; break;
|
||||
case INAPPLICABLE:
|
||||
case MISSING: result = false; break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Return true if the contained value is considered to be 'empty'
|
||||
[[nodiscard]] bool empty() const noexcept
|
||||
{
|
||||
@@ -816,9 +799,6 @@ struct item_handle
|
||||
*/
|
||||
[[nodiscard]] bool empty() const;
|
||||
|
||||
/** Easy way to test for an empty item */
|
||||
explicit operator bool() const { return not empty(); }
|
||||
|
||||
/** Return a std::string_view for the contents */
|
||||
[[nodiscard]] std::string_view text_() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user