//          Copyright Carl Philipp Reh 2009 - 2021.
// Distributed under the Boost Software License, Version 1.0.
//    (See accompanying file LICENSE_1_0.txt or copy at
//          http://www.boost.org/LICENSE_1_0.txt)

#ifndef FCPPT_MATH_DETAIL_INIT_STORAGE_HPP_INCLUDED
#define FCPPT_MATH_DETAIL_INIT_STORAGE_HPP_INCLUDED

#include <fcppt/array/init.hpp>
#include <fcppt/math/is_static_storage.hpp>
#include <fcppt/type_traits/value_type.hpp>

namespace fcppt::math::detail
{
template <typename Result>
inline Result init_storage(fcppt::type_traits::value_type<Result> const &_value)
  requires fcppt::math::is_static_storage<Result>::value
{
  return Result{fcppt::array::init<typename Result::array_type>([_value](auto) { return _value; })};
}
}

#endif
