My Project
Functions
fill.hpp File Reference
#include "cstdint.hpp"
#include "cstring.hpp"
#include "enable_if.hpp"
#include "is_constant_evaluated.hpp"
#include "is_fundamental.hpp"
#include "is_copy_assignable.hpp"
#include "is_nothrow_copy_assignable.hpp"

Go to the source code of this file.

Functions

template<typename VIEW , typename T >
constexpr void bsl::details::fill_impl (VIEW &vw, T const &value) noexcept(//-- is_nothrow_copy_assignable< T >::value)
 Provides the internal implementation of the fill function. Specifically, this is the non-optimized version. More...
 
template<typename VIEW , typename T >
constexpr enable_if_t< is_copy_assignable< T >::value > bsl::fill (VIEW &vw, T const &value) noexcept(//-- is_nothrow_copy_assignable< T >::value)
 Sets all elements of a view to "value". T must be copy assignable. More...
 
template<typename ITER , typename T >
constexpr enable_if_t< is_copy_assignable< T >::value > bsl::fill (ITER first, ITER last, T const &value) noexcept(//-- is_nothrow_copy_assignable< T >::value)
 Sets all elements of a view to "value". T must be copy assignable. More...
 

Detailed Description

Function Documentation

◆ fill_impl()

template<typename VIEW , typename T >
constexpr void bsl::details::fill_impl ( VIEW &  vw,
T const &  value 
)
noexcept

Provides the internal implementation of the fill function. Specifically, this is the non-optimized version.

Template Parameters
VIEWthe type of view to fill
Tthe type to fill the view with
Parameters
vwthe view to fill
valuewhat to fill the view with

◆ fill() [1/2]

template<typename VIEW , typename T >
constexpr enable_if_t<is_copy_assignable<T>::value> bsl::fill ( VIEW &  vw,
T const &  value 
)
noexcept

Sets all elements of a view to "value". T must be copy assignable.

#include <bsl/fill.hpp>
#include <bsl/array.hpp>
#include <bsl/for_each.hpp>
#include <bsl/debug.hpp>
namespace bsl
{
inline void
example_fill_overview() noexcept
{
constexpr bsl::uintmax val{1U};
constexpr bsl::uintmax size{42U};
bsl::fill(arr, val);
bsl::uintmax sum{};
bsl::for_each(arr, [&sum](auto const &e) mutable noexcept {
sum += e;
});
if (size == sum) {
bsl::print() << "success\n";
}
}
}
Template Parameters
Tthe type that defines the values being filled
Parameters
vwthe view to fill
valuethe value to set the view's elements to
Returns
return's void
Exceptions
throwsif the copy assignment of T throws

◆ fill() [2/2]

template<typename ITER , typename T >
constexpr enable_if_t<is_copy_assignable<T>::value> bsl::fill ( ITER  first,
ITER  last,
T const &  value 
)
noexcept

Sets all elements of a view to "value". T must be copy assignable.

#include <bsl/fill.hpp>
#include <bsl/array.hpp>
#include <bsl/for_each.hpp>
#include <bsl/debug.hpp>
namespace bsl
{
inline void
example_fill_overview() noexcept
{
constexpr bsl::uintmax val{1U};
constexpr bsl::uintmax size{42U};
bsl::fill(arr, val);
bsl::uintmax sum{};
bsl::for_each(arr, [&sum](auto const &e) mutable noexcept {
sum += e;
});
if (size == sum) {
bsl::print() << "success\n";
}
}
}
Template Parameters
Tthe type that defines the values being filled
Parameters
firstthe position to start the loop
lastthe position to end the loop
valuethe value to set the view's elements to
Returns
return's void
Exceptions
throwsif the copy assignment of T throws