Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
PS Namespace Reference

Namespaces

namespace  Enet
 
namespace  Loader
 
namespace  Memory
 
namespace  Net
 

Classes

struct  CapacityExceededException
 
class  span
 
class  StaticVector
 A conntainer close to std::vector but the elements are stored in place: There is a fixed capacity and there is no dynamic memory allocation. More...
 
class  StringBuilder
 A helper class to build string in-place without additional cost of allocations, locales and format parsing. More...
 

Functions

template<typename Range , typename T = typename Range::value_type>
bool contains (Range &&range, const T &value)
 Simplifed version of std::ranges::contains (C++23) as we don't support the original one yet. More...
 
template<typename Char >
void ReplaceSubrange (std::basic_string< Char > &base, std::basic_string_view< std::type_identity_t< Char > > tag, std::basic_string_view< std::type_identity_t< Char > > value)
 Replaces all occurrences of a substring within a string with a given value. More...
 
template<size_t N>
constexpr auto MakeSmallestCapableUnsigned ()
 
template<size_t N>
constexpr auto MakeSmallestCapableSigned ()
 

Function Documentation

◆ contains()

template<typename Range , typename T = typename Range::value_type>
bool PS::contains ( Range &&  range,
const T &  value 
)

Simplifed version of std::ranges::contains (C++23) as we don't support the original one yet.

The naming intentionally follows the STL version to make the future replacement easier with less changing. It supports only a subset of std::ranges::contains functionality.

◆ MakeSmallestCapableSigned()

template<size_t N>
constexpr auto PS::MakeSmallestCapableSigned ( )
constexpr

◆ MakeSmallestCapableUnsigned()

template<size_t N>
constexpr auto PS::MakeSmallestCapableUnsigned ( )
constexpr

◆ ReplaceSubrange()

template<typename Char >
void PS::ReplaceSubrange ( std::basic_string< Char > &  base,
std::basic_string_view< std::type_identity_t< Char > >  tag,
std::basic_string_view< std::type_identity_t< Char > >  value 
)

Replaces all occurrences of a substring within a string with a given value.

This function searches the input string base for all instances of the specified tag and replaces them with the provided value. The replacement is performed in-place and modifies the original string.

Parameters
baseThe string in which to perform replacements. Modified in-place.
tagThe substring to search for (e.g., a placeholder like L"{civ}").
valueThe string to replace each occurrence of tag with.