Skip to content

Commit

Permalink
Variant/Option: only std::variant as source
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Jan 11, 2022
1 parent b8981c0 commit f3183e3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 68 deletions.
11 changes: 5 additions & 6 deletions include/openPMD/auxiliary/Option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@

#pragma once

#include "VariantSrc.hpp"

#include <utility> // std::forward, std::move
#include <type_traits>
#include <variant> // IWYU pragma: export


namespace openPMD
Expand All @@ -39,14 +38,14 @@ namespace auxiliary
} // namespace detail

/**
* @brief Simple Option type based on variantSrc::variant.
* @brief Simple Option type based on std::variant.
*
* @tparam T Type that can be optionally stored in an Optional object.
*/
template< typename T >
class Option
{
using data_t = variantSrc::variant< T, detail::Empty >;
using data_t = std::variant< T, detail::Empty >;
data_t m_data;

public:
Expand Down Expand Up @@ -146,7 +145,7 @@ namespace auxiliary
T const &
get() const
{
return variantSrc::template get< T >( m_data );
return std::template get< T >( m_data );
}

/**
Expand All @@ -158,7 +157,7 @@ namespace auxiliary
T &
get()
{
return variantSrc::template get< T >( m_data );
return std::template get< T >( m_data );
}
};

Expand Down
3 changes: 1 addition & 2 deletions include/openPMD/auxiliary/Variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
*/
#pragma once

#include "VariantSrc.hpp"

#include <cstddef>
#include <type_traits>
#include <variant> // IWYU pragma: export


namespace openPMD
Expand Down
11 changes: 1 addition & 10 deletions include/openPMD/auxiliary/VariantSrc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,5 @@

#include "openPMD/config.hpp"

#if openPMD_HAS_CXX17
# include <variant> // IWYU pragma: export
#include <variant> // IWYU pragma: export
namespace variantSrc = std;
#else
// see: https://github.com/mpark/variant/pull/76
# if defined(__EXCEPTIONS)
# define MPARK_EXCEPTIONS
# endif
# include <mpark/variant.hpp> // IWYU pragma: export
namespace variantSrc = mpark;
#endif
49 changes: 0 additions & 49 deletions include/openPMD/binding/python/Variant.hpp

This file was deleted.

1 change: 0 additions & 1 deletion src/binding/python/Attributable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "openPMD/backend/Attribute.hpp"
#include "openPMD/auxiliary/Variant.hpp"
#include "openPMD/binding/python/Numpy.hpp"
#include "openPMD/binding/python/Variant.hpp"
#include "openPMD/DatatypeHelpers.hpp"

#include <pybind11/pybind11.h>
Expand Down

0 comments on commit f3183e3

Please sign in to comment.