Program Listing for File multidim_space.hpp¶
↰ Return to documentation for file (include/ripple/space/multidim_space.hpp
)
//==--- ripple/core/multidim/multidim_space.hpp ------------ -*- C++ -*- ---==//
//
// Ripple
//
// Copyright (c) 2019, 2020 Rob Clucas.
//
// This file is distributed under the MIT License. See LICENSE for details.
//
//==------------------------------------------------------------------------==//
//
#ifndef RIPPLE_SPACE_MULTIDIM_SPACE_HPP
#define RIPPLE_SPACE_MULTIDIM_SPACE_HPP
#include "space_traits.hpp"
#include <ripple/utility/forward.hpp>
#include <ripple/utility/type_traits.hpp>
namespace ripple {
template <typename Impl>
struct MultidimSpace {
private:
ripple_all constexpr auto impl() const noexcept -> const Impl* {
return static_cast<const Impl*>(this);
}
ripple_all constexpr auto impl() noexcept -> Impl* {
return static_cast<Impl*>(this);
}
public:
ripple_all constexpr auto padding() noexcept -> size_t& {
return impl()->padding();
}
ripple_all constexpr auto padding() const noexcept -> size_t {
return impl()->padding();
}
ripple_all constexpr auto dim_padding() const noexcept -> size_t {
return impl()->dim_padding();
}
ripple_all constexpr auto dimensions() const noexcept -> size_t {
return SpaceTraits<Impl>::dimensions;
}
template <typename Dim>
ripple_all constexpr auto size(Dim&& dim) const noexcept -> size_t {
return impl()->size(ripple_forward(dim));
}
ripple_all constexpr auto size() const noexcept -> size_t {
return impl()->size();
}
template <typename Dim>
ripple_all constexpr auto
internal_size(Dim&& dim) const noexcept -> size_t {
return impl()->internal_size(ripple_forward(dim));
}
ripple_all constexpr auto internal_size() const noexcept -> size_t {
return impl()->internal_size();
}
template <typename Dim>
ripple_all constexpr auto step(Dim&& dim) const noexcept -> size_t {
return impl()->step(ripple_forward(dim));
}
};
} // namespace ripple
#endif // RIPPLE_SPACE_MULTIDIM_SPACE_HPP