FE 0.15.0
A C++23 toolkit for writing compiler/interpreter frontends.
Loading...
Searching...
No Matches
algo.h File Reference
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <algorithm>
#include <array>
#include <bit>
#include <functional>
#include <iterator>
#include <ranges>
#include <string>
#include <string_view>
#include <type_traits>
Include dependency graph for algo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  fe

Functions

Utility Functions
template<class D, class S>
requires (std::is_trivially_copyable_v<S> && std::is_trivially_copyable_v<D>)
constexpr D fe::bitcast_resize (const S &src) noexcept
 A bitcast from src of type S to D, supporting different sizes.
constexpr std::uint64_t fe::pad (std::uint64_t offset, std::uint64_t align) noexcept
 Rounds offset up to the next multiple of align.
constexpr bool fe::is_aligned (std::uint64_t offset, std::uint64_t align) noexcept
Algorithms
template<std::random_access_iterator I, class T, class L = std::less<>>
constexpr I fe::binary_find (I begin, I end, const T &val, L lt={})
template<std::ranges::random_access_range R, class T, class L = std::less<>>
requires std::ranges::common_range<R>
constexpr auto fe::binary_find (R &&r, const T &val, L lt={})
void fe::find_and_replace (std::string &str, std::string_view what, std::string_view repl)
 Replaces all occurrences of what with repl.