// Copyright 2019 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef LIBBRILLO_BRILLO_ARRAY_UTILS_H_ #define LIBBRILLO_BRILLO_ARRAY_UTILS_H_ #include #include namespace brillo { // Create a std::array from a set of values without manually specifying the // size of the array. Note that unlike the make_array likely to make its way // into C++20, this function always requires the user to specify ElementType. // This is done so that users are not surprised by the element type of resulting // arrays when std::common_type is used. template constexpr auto make_array(T&&... values) { return std::array{ static_cast(std::forward(values))...}; } } // namespace brillo #endif // LIBBRILLO_BRILLO_ARRAY_UTILS_H_