24#ifndef MORPHEUS_DYNAMIC_COPY_IMPL_HPP
25#define MORPHEUS_DYNAMIC_COPY_IMPL_HPP
27#include <Morpheus_Exceptions.hpp>
28#include <Morpheus_FormatTraits.hpp>
29#include <Morpheus_FormatTags.hpp>
31#include <impl/Morpheus_Copy_Impl.hpp>
32#include <impl/Morpheus_Variant.hpp>
38 using result_type = void;
40 template <
typename SourceType,
typename DestinationType>
41 result_type operator()(
42 const SourceType& src, DestinationType& dst,
43 typename std::enable_if_t<
46 SourceType, DestinationType>::value>* =
nullptr) {
51 template <
typename SourceType,
typename DestinationType>
52 result_type operator()(
53 const SourceType& src, DestinationType& dst,
54 typename std::enable_if_t<
57 SourceType, DestinationType>::value)>* =
nullptr) {
59 "Morpheus::copy() is only available between the same container types "
61 std::to_string(src.format_index()) +
62 " != " + std::to_string(dst.format_index()) +
63 "). Please use Morpheus::convert() instead to perform conversions "
64 "between different types.");
68template <
typename SourceType,
typename DestinationType>
69void copy(
const SourceType& src, DestinationType& dst,
70 typename std::enable_if_t<
74 if (src.const_formats().index() ==
static_cast<int>(dst.format_enum())) {
75 auto f = std::bind(
Impl::copy_fn(), std::placeholders::_1, std::ref(dst));
76 Morpheus::Impl::Variant::visit(f, src.const_formats());
79 "Morpheus::copy() is only available between the same container types. "
80 "Active type of dynamic matrix should match the type of destination "
81 "matrix. Please use Morpheus::convert() instead to perform conversions "
82 "between different types.");
86template <
typename SourceType,
typename DestinationType>
88 const SourceType& src, DestinationType& dst,
89 typename std::enable_if_t<
93 auto f = std::bind(Impl::copy_fn(), std::cref(src), std::placeholders::_1);
94 Impl::Variant::visit(f, dst.formats());
97template <
typename SourceType,
typename DestinationType>
99 const SourceType& src, DestinationType& dst,
100 typename std::enable_if_t<
104 Impl::Variant::visit(Impl::copy_fn(), src.const_formats(), dst.formats());
A valid Sparse Matrix container is the one that has a valid Sparse Matrix tag i.e satisfies the has_s...
Definition: Morpheus_FormatTraits.hpp:85
Generic Morpheus interfaces.
Definition: dummy.cpp:24
Definition: Dynamic/Morpheus_Copy_Impl.hpp:37