3.7.0
Freundlich's C++ toolkit
Classes | Typedefs | Functions
fcppt::container::grid Namespace Reference

Contains fcppt::container::grid::object and helper types/functions for it. More...

Classes

struct  is_object
 
struct  is_object< fcppt::container::grid::object< T, N, A > >
 
struct  min_tag
 
class  object
 An n-dimensional array. More...
 
class  pos_iterator
 An iterator over grid position. More...
 
class  pos_range
 A range over grid position. More...
 
class  pos_ref_iterator
 An iterator over grid references. More...
 
class  pos_ref_range
 A range over grid references. More...
 
class  pos_reference
 A reference to a grid cell and its position. More...
 
class  spiral_iterator
 
class  spiral_range
 
struct  sup_tag
 

Typedefs

template<typename SizeType , fcppt::container::grid::size_type N>
using dim = fcppt::math::dim::static_< SizeType, N >
 The type of a grid's size. More...
 
template<typename Grid >
using dim_type = typename fcppt::container::grid::detail::dim_type< Grid >::type
 The dim type of a grid. More...
 
template<typename Type >
using is_static_row = fcppt::array::is_object< Type >
 Checks if a type is an fcppt::container::grid::static_row. More...
 
template<typename Pos >
using min_from_pos = fcppt::container::grid::min< fcppt::type_traits::value_type< Pos >, Pos::static_size::value >
 Creates the min from a pos type. More...
 
template<typename SizeType , fcppt::container::grid::size_type Size>
using min = fcppt::strong_typedef< fcppt::container::grid::pos< SizeType, Size >, fcppt::container::grid::min_tag >
 The start type of a pos range. More...
 
template<typename Pos >
using moore_neighbor_array = fcppt::array::object< Pos, 8 >
 The type return by fcppt::container::grid::moore_neighbors. More...
 
template<typename Pos >
using neumann_neighbor_array = fcppt::array::object< Pos, 4 >
 The type return by fcppt::container::grid::neumann_neighbors. More...
 
template<typename SizeType , fcppt::container::grid::size_type N>
using pos = fcppt::math::vector::static_< SizeType, N >
 The type used to index a grid. More...
 
template<typename Grid >
using pos_type = typename fcppt::container::grid::detail::pos_type< Grid >::type
 The pos type of a grid. More...
 
using size_type = fcppt::math::size_type
 An unsigned type used to count grid dimensions. More...
 
template<typename T , fcppt::container::grid::size_type N>
using static_row_type = fcppt::array::object< T, N >
 The type of a static row (an array). More...
 
template<typename Pos >
using sup_from_pos = fcppt::container::grid::sup< fcppt::type_traits::value_type< Pos >, Pos::static_size::value >
 Creates the sup from a pos type. More...
 
template<typename SizeType , fcppt::container::grid::size_type Size>
using sup = fcppt::strong_typedef< fcppt::container::grid::pos< SizeType, Size >, fcppt::container::grid::sup_tag >
 The one-past-the-end type of a pos range. More...
 

Functions

template<typename Function , typename Grid1 , typename... Grids>
auto apply (Function const &_function, Grid1 &&_grid1, Grids &&..._grids) -> fcppt::container::grid::object< decltype(_function(fcppt::move_if_rvalue< Grid1 >(_grid1.get_unsafe(std::declval< fcppt::container::grid::pos_type< fcppt::type_traits::remove_cv_ref_t< Grid1 >>>())), fcppt::move_if_rvalue< Grids >(_grids.get_unsafe(std::declval< fcppt::container::grid::pos_type< fcppt::type_traits::remove_cv_ref_t< Grid1 >>>()))...)), fcppt::type_traits::remove_cv_ref_t< Grid1 >::static_size::value >
 Applies a function to multiple grids of the same size. More...
 
template<typename Grid >
fcppt::optional::reference< fcppt::container::to_value_type< Grid > > at_optional (Grid &_grid, fcppt::container::grid::pos_type< std::remove_cv_t< Grid >> const _pos)
 Returns a grid element as an optional. More...
 
template<typename Source , fcppt::container::grid::size_type Size>
fcppt::container::grid::min< std::make_unsigned_t< Source >, Size > clamped_min (fcppt::container::grid::pos< Source, Size > const _pos)
 Clamps a signed position to min. More...
 
template<typename Source , fcppt::container::grid::size_type Size>
fcppt::container::grid::sup< Source, Size > clamped_sup (fcppt::container::grid::pos< Source, Size > const _pos, fcppt::container::grid::dim< Source, Size > const _size)
 Clamps a position to a grid's size. More...
 
template<typename Dest , typename Source , fcppt::container::grid::size_type Size>
fcppt::container::grid::sup< Dest, Size > clamped_sup_signed (fcppt::container::grid::pos< Source, Size > const _pos, fcppt::container::grid::dim< Dest, Size > const _size)
 Clamps a signed position to a grid's size. More...
 
template<typename T , fcppt::container::grid::size_type N, typename A >
bool operator== (fcppt::container::grid::object< T, N, A > const &_a, fcppt::container::grid::object< T, N, A > const &_b)
 Compares two grids for equality. More...
 
template<typename T , fcppt::container::grid::size_type N, typename A >
bool operator!= (fcppt::container::grid::object< T, N, A > const &_a, fcppt::container::grid::object< T, N, A > const &_b)
 !(a == b) More...
 
template<typename T , fcppt::container::grid::size_type N, typename A >
bool operator< (fcppt::container::grid::object< T, N, A > const &_a, fcppt::container::grid::object< T, N, A > const &_b)
 Lexicographically compares two grids. More...
 
template<typename T , fcppt::container::grid::size_type N, typename A >
bool operator> (fcppt::container::grid::object< T, N, A > const &_a, fcppt::container::grid::object< T, N, A > const &_b)
 b < a More...
 
template<typename T , fcppt::container::grid::size_type N, typename A >
bool operator<= (fcppt::container::grid::object< T, N, A > const &_a, fcppt::container::grid::object< T, N, A > const &_b)
 !(a > b) More...
 
template<typename T , fcppt::container::grid::size_type N, typename A >
bool operator>= (fcppt::container::grid::object< T, N, A > const &_a, fcppt::container::grid::object< T, N, A > const &_b)
 !(a < b) More...
 
template<typename SizeType , fcppt::container::grid::size_type Size>
fcppt::container::grid::pos< SizeType, Size > end_position (fcppt::container::grid::min< SizeType, Size > const _min, fcppt::container::grid::sup< SizeType, Size > const _sup)
 The end position of a range. More...
 
template<typename T , fcppt::container::grid::size_type N, typename A , typename Function >
void fill (fcppt::container::grid::object< T, N, A > &_grid, Function const &_function)
 Fills a grid using a function. More...
 
template<typename T , fcppt::container::grid::size_type N, typename A >
bool in_range (fcppt::container::grid::object< T, N, A > const &_grid, fcppt::container::grid::pos_type< fcppt::container::grid::object< T, N, A >> const &_pos)
 Checks if the given position _pos is out of bounds. More...
 
template<typename T , fcppt::container::grid::size_type N>
bool in_range_dim (fcppt::container::grid::dim< T, N > const _dim, fcppt::container::grid::pos< T, N > const _pos)
 Checks if the given position _pos is out of bounds. More...
 
template<typename T , fcppt::container::grid::size_type N, typename A , typename F , typename Interpolator >
interpolate (fcppt::container::grid::object< T, N, A > const &_grid, fcppt::math::vector::static_< F, N > const &_floating_point_position, Interpolator const &_interpolator)
 Interpolates a value inside the grid cells. More...
 
template<typename SizeType , fcppt::container::grid::size_type N>
fcppt::container::grid::min_from_pos< fcppt::container::grid::pos< SizeType, N > > make_min (fcppt::container::grid::pos< SizeType, N > const _pos)
 Creates min from a pos value. More...
 
template<typename SizeType , fcppt::container::grid::size_type Size>
fcppt::container::grid::pos_range< SizeType, Size > make_pos_range (fcppt::container::grid::dim< SizeType, Size > const _size)
 A range over all positions. More...
 
template<typename SizeType , fcppt::container::grid::size_type Size>
fcppt::container::grid::pos_range< SizeType, Size > make_pos_range_start_end (fcppt::container::grid::min< SizeType, Size > const _min, fcppt::container::grid::sup< SizeType, Size > const _sup)
 A sub range over positions. More...
 
template<typename Grid >
fcppt::container::grid::pos_ref_range< Grid const > make_pos_ref_crange (Grid const &_grid)
 A const pos ref range over a grid. More...
 
template<typename Grid >
fcppt::container::grid::pos_ref_range< Grid const > make_pos_ref_crange_start_end (Grid const &_grid, typename fcppt::container::grid::pos_ref_range< Grid const >::min_type const _min, typename fcppt::container::grid::pos_ref_range< Grid const >::sup_type const _sup)
 A const pos ref range over a sub-grid. More...
 
template<typename Grid >
fcppt::container::grid::pos_ref_range< Grid > make_pos_ref_range (Grid &_grid)
 A pos ref range over a grid. More...
 
template<typename Grid >
fcppt::container::grid::pos_ref_range< Grid > make_pos_ref_range_start_end (Grid &_grid, typename fcppt::container::grid::pos_ref_range< Grid >::min_type const _min, typename fcppt::container::grid::pos_ref_range< Grid >::sup_type const _sup)
 A pos ref range over a sub-grid. More...
 
template<typename Pos >
fcppt::container::grid::spiral_range< Pos > make_spiral_range (Pos const _start, fcppt::type_traits::value_type< Pos > const _max_dist)
 
template<typename SizeType , fcppt::container::grid::size_type N>
fcppt::container::grid::sup_from_pos< fcppt::container::grid::pos< SizeType, N > > make_sup (fcppt::container::grid::pos< SizeType, N > const _pos)
 Creates sup from a pos value. More...
 
template<typename Source , typename Function >
auto map (Source &&_source, Function const &_function) -> fcppt::container::grid::object< decltype(_function(fcppt::move_if_rvalue< Source >(_source.get_unsafe(std::declval< fcppt::container::grid::pos_type< fcppt::type_traits::remove_cv_ref_t< Source >>>())))), fcppt::type_traits::remove_cv_ref_t< Source >::static_size::value >
 Maps over grids. More...
 
template<typename SizeType , fcppt::container::grid::size_type Size>
bool min_less_sup (fcppt::container::grid::min< SizeType, Size > const _min, fcppt::container::grid::sup< SizeType, Size > const _sup)
 Checks if min is strictly less than sup. More...
 
template<typename T , fcppt::container::grid::size_type N>
fcppt::container::grid::moore_neighbor_array< fcppt::container::grid::pos< T, N > > moore_neighbors (fcppt::container::grid::pos< T, N > const _pos)
 Computes the Moore neighbors. More...
 
template<typename T , fcppt::container::grid::size_type N>
fcppt::container::grid::neumann_neighbor_array< fcppt::container::grid::pos< T, N > > neumann_neighbors (fcppt::container::grid::pos< T, N > const _pos)
 Computes the von Neumann neighbors. More...
 
template<typename SizeType , fcppt::container::grid::size_type Size>
fcppt::container::grid::pos< SizeType, Size > next_position (fcppt::container::grid::pos< SizeType, Size > const _current, fcppt::container::grid::min< SizeType, Size > const _min, fcppt::container::grid::sup< SizeType, Size > const _sup)
 Returns the next position in a grid range. More...
 
template<typename T , fcppt::container::grid::size_type N, typename A >
void swap (fcppt::container::grid::object< T, N, A > &, fcppt::container::grid::object< T, N, A > &)
 
template<typename SizeType , fcppt::container::grid::size_type Size>
SizeType offset (fcppt::container::grid::pos< SizeType, Size > const &_pos, fcppt::container::grid::dim< SizeType, Size > const &_size)
 Returns the absolute offset of a position. More...
 
template<typename Ch , typename Traits , typename T , fcppt::container::grid::size_type N, typename A >
std::basic_ostream< Ch, Traits > & operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::container::grid::object< T, N, A > const &_object)
 Outputs a grid. More...
 
template<typename SizeType , fcppt::container::grid::size_type Size>
fcppt::container::grid::dim< SizeType, Size > range_dim (fcppt::container::grid::min< SizeType, Size > const _min, fcppt::container::grid::sup< SizeType, Size > const _sup)
 The dimension of a grid range. More...
 
template<typename SizeType , fcppt::container::grid::size_type Size>
SizeType range_size (fcppt::container::grid::min< SizeType, Size > const _min, fcppt::container::grid::sup< SizeType, Size > const _sup)
 The number of elements in a grid range. More...
 
template<typename Grid , typename Function >
fcppt::type_traits::remove_cv_ref_t< Grid > resize (Grid &&_grid, fcppt::container::grid::dim_type< fcppt::type_traits::remove_cv_ref_t< Grid >> const &_new_size, Function const &_init)
 Returns a resized grid with potentially new elements. More...
 
template<typename Arg1 , typename... Args, typename = std::enable_if_t<std::conjunction_v<std::is_same< fcppt::type_traits::remove_cv_ref_t<Args>, fcppt::type_traits::remove_cv_ref_t<Arg1>>...>>>
fcppt::container::grid::static_row_type< fcppt::type_traits::remove_cv_ref_t< Arg1 >, fcppt::cast::size< fcppt::container::grid::size_type >sizeof...(Args)+1U)> static_row (Arg1 &&_arg1, Args &&..._args)
 Creates an fcppt::container::grid::static_row_type. More...
 

Detailed Description

Contains fcppt::container::grid::object and helper types/functions for it.

Function Documentation

◆ make_spiral_range()

template<typename Pos >
fcppt::container::grid::spiral_range<Pos> fcppt::container::grid::make_spiral_range ( Pos const  _start,
fcppt::type_traits::value_type< Pos > const  _max_dist 
)
inline

◆ swap()

template<typename T , fcppt::container::grid::size_type N, typename A >
void fcppt::container::grid::swap ( fcppt::container::grid::object< T, N, A > &  ,
fcppt::container::grid::object< T, N, A > &   
)