Skip to content

batt

batt🔗

Namespaces🔗

Name
batt::constants
batt::detail
batt::features
batt::int_types
batt::seq

Classes🔗

Name
class batt::BasicRunningTotal
struct batt::RetryState
struct batt::ExponentialBackoff
struct batt::TaskSleepImpl
struct batt::DefaultStatusIsRetryableImpl
class batt::BasicExecutor
class batt::SingleBufferSource
Adapts a single ConstBuffer to be a BufferSource.
class batt::BufferSource
class batt::SeqBufferSource
class batt::TakeNSource
class batt::FilterBufferSource
class batt::MapBufferSource
class batt::PrependBufferSource
class batt::BufferedChannel
class batt::CancelToken
Enables effective cancellation of arbitrary async operations.
class batt::Channel
A Channel is a one-way, unbuffered, SPSC (single-producer, single consumer) communication/synchronization primitive.
class batt::AbstractStackAllocator
class batt::StackAllocatorImpl
class batt::StackAllocator
class batt::DebugInfoFrame
class batt::BasicFakeExecutor
class batt::FakeExecutionContext
class batt::FakeTaskScheduler
class batt::FakeTimeService
class batt::BasicScopedChunk
A fetched chunk of data that is automatically consumed (partially or entirely) when it goes out of scope.
class batt::Promise
An obligation to provide a value of type T to a Future.
class batt::Future
A value of type T that will be provided at some point in the future.
class batt::BasicAbstractHandler
A type-erased async completion handler with linked list pointers.
class batt::BasicHandlerImpl
class batt::UniqueHandler
class batt::HandlerBinder
class batt::HandlerMemoryBase
Abstract base for HandlerMemory.
class batt::HandlerMemory
A chunk of memory that can be attached to an async completion handler.
class batt::HandlerAllocator
An allocator associated with a completion handler.
class batt::CustomAllocHandler
Wrapper for an async completion handler type Handler.
class batt::InlineSubTask
A scoped asynchronous task with inline stack memory.
class batt::IOResult
class batt::Latch
A write-once, single-value synchronized container.
class batt::LazyLatch
A write-once, single-value synchronized container that is populated lazily by an init_fn when the value is requested.
class batt::BasicMCSMutex
A fair mutual exclusion lock based on the MCS lock algorithm.
class batt::MutexBase
Base class of typed Mutex; implements core logic without any type dependencies.
class batt::LockBase
class batt::ScopedLock
class batt::Mutex
Provides mutually-exclusive access to an instance of type T.
class batt::Pinnable
class batt::Pin
class batt::PinnablePtr
A raw pointer augmented to support the batt::Pinnable interface, so that a batt::Pin> can be created to block the destruction of the pointer.
class batt::PreallocatedTask
class batt::PriorityWatch
class batt::QueueBase
Type-agnostic base class for all Queue types.
class batt::Queue
Unbounded multi-producer/multi-consumer (MPMC) FIFO queue.
class batt::BasicRateLimiter
struct batt::DumpReadWriteLockState
class batt::BasicReadWriteLock
An MCS-style fair reader/writer lock.
class batt::ScopedReadWriteLockImpl
class batt::ReadWriteMutex
Mutex wrapper for a value of type T, providing exclusive read/write access and non-exclusive read-only access.
class batt::Runtime
class batt::ScalableGrantIssuer
A pool from which ScalableGrant instances are allocated.
class batt::ScalableGrant
A claim on some counted resource.
class batt::SimpleExecutionContext
A minimal multi-threaded execution context implementation, suitable for parallel-compute thread pools.
struct batt::WorkSliceParams
struct batt::WorkSlicePlan
class batt::SpinGrant
A claim on some counted resource.
class batt::StreamBuffer
class batt::Task
A user-space cooperatively scheduled thread of control.
class batt::TaskScheduler
class batt::NullTaskScheduler
class batt::Watch
A batt::Watch is like a std::atomic that you can block on, synchronously and asynchronously; see also batt::WatchAtomic.
struct batt::HoldOwnership
struct batt::ReleaseOwnership
class batt::WatchAtomic
Watch for atomic primitive type.
class batt::Watch< bool >
class batt::Watch< i8 >
class batt::Watch< i16 >
class batt::Watch< i32 >
class batt::Watch< i64 >
class batt::Watch< u8 >
class batt::Watch< u16 >
class batt::Watch< u32 >
class batt::Watch< u64 >
class batt::Watch< void * >
class batt::Watch< T * >
class batt::WorkContext
class batt::ScopedWorkContext
class batt::Worker
class batt::WorkerPool
class batt::ScopedWorkerThreadPool
class batt::AtomicCounterGauge
An atomic variable that maintains a gauge-like value, which can rise and fall over time, by means of two monotonic counters: one for increases, one for decreases.
struct batt::LeastUpperBound
struct batt::GreatestLowerBound
class batt::ManagedBuffer
class batt::BufferViewImpl
class batt::ConstBufferView
class batt::MutableBufferView
class batt::CaseOfVisitor
class batt::CpuCacheLineIsolated
struct batt::ThreadPoolConfig
struct batt::DoNothing
struct batt::ByteSwap
class batt::StatusException
Exception wrapper for a batt::Status value.
class batt::FinalAct
struct batt::HostAddress
class batt::HttpChunkDecoder
BufferSource transformer that decodes HTTP chunked content fetched from Src.
class batt::HttpClient
An HTTP/1.1 client implementation.
class batt::DefaultHttpClient
A singleton instance of HttpClient; contains an io_context and thread pool (size == 1).
class batt::BasicHttpClientConnection
class batt::HttpClientHostContext
struct batt::HttpData
class batt::HttpMessageBase
The common base type for HttpRequest and HttpResponse.
struct batt::HttpMessageInfo
A summary of information about a response message that is necessary for the connection to correctly handle it.
class batt::HttpRequest
class batt::HttpResponse
class batt::HttpServerConnection
class batt::HttpServer
An HTTP server.
struct batt::HttpServerSettings
struct batt::HttpVersion
class batt::SslTransport
An SSL/TLS based transport for HTTPS clients.
class batt::TcpTransport
A thread-safe socket based TCP connection for HTTP clients.
class batt::InstanceCounter
A quick and easy way to track the number of instances of a given type in existence; just add batt::InstanceCounter as a field or base class of T.
struct batt::IClosedOpen
struct batt::IClosed
struct batt::BasicInterval
A set of totally ordered values, defined by a lower and upper bound.
struct batt::IntervalTraits
struct batt::IntervalTraitsBase
struct batt::IntervalTraits< T, U, InclusiveLowerBound::kTrue, InclusiveUpperBound::kFalse, OrderFn, EqualFn >
struct batt::IntervalTraits< T, U, InclusiveLowerBound::kTrue, InclusiveUpperBound::kTrue, OrderFn, EqualFn >
class batt::CountMetric
class batt::LatencyMetric
class batt::LatencyTimer
class batt::RateMetric
class batt::GaugeMetric
A Metric collector that stores and reports a single instantaneous value.
class batt::StatsMetric
Collect count, total, max and min values for multiple samples.
class batt::HistogramMetric
Collect histogram values for multiple samples.
class batt::MetricCsvFormatter
class batt::MetricDumper
class batt::MetricFormatter
class batt::MetricOpenTelemetryFormatter
Format metrics into OpenTelemetry data format: {
struct batt::MetricLabel
class batt::MetricExporter
class batt::ScalarMetricExporter
Exports a single value metric.
class batt::DerivedMetricExporter
class batt::VariableExporter
class batt::WatchExporter
class batt::QueueDepthExporter
class batt::MetricRegistry
class batt::PrometheusMetricExporter
class batt::NoDestruct
struct batt::NoneType
struct batt::InPlaceInitType
class batt::Optional
class batt::Optional< T & >
struct batt::NoopDeleter
class batt::RadixQueue
class batt::Ref
class batt::BoxedSeq
struct batt::IsBoxedSeq
struct batt::IsBoxedSeq< BoxedSeq< T > >
struct batt::SeqItem_Impl
struct batt::SkipNBinder
class batt::SkipN
class batt::SubRangeSeq
struct batt::VecSeqBase
class batt::VecSeq
class batt::SeqRef
struct batt::SharedPtrImpl
class batt::SkipNode
class batt::SkipNodeBase
class batt::SmallFn
A type-erased container for a callable function-like object with a statically bounded maximum size.
class batt::kAllowAlloc
struct batt::StateMachineModelCheckAdvancedOptions
class batt::BasicStateMachineEntropySource
struct batt::StateMachineBranch
class batt::ExhaustiveModelChecker
struct batt::StateMachineResult
struct batt::StateMachineTraits
class batt::StochasticModelChecker
class batt::StateMachineModel
struct batt::StaticBinaryAssertion
struct batt::StaticSameTypeAssertion
class batt::StatusOr
class batt::Status
class batt::StatusOr< Status >
class batt::StatusOr< StatusOr< T > >
struct batt::RemoveStatusOrImpl
struct batt::RemoveStatusOrImpl< StatusOr< T > >
struct batt::EscapedStringLiteral
struct batt::HexByteDumper
struct batt::SizeDumper
Wrapper around usize (std::size_t) that prints as human-readable sizes.
class batt::RangeDumper
class batt::StrongType
struct batt::IsStrongType
struct batt::IsStrongType< StrongType< T, Tag > >
struct batt::MorphTuple
struct batt::MorphTuple< TemplateT, std::tuple< Ts... > >
struct batt::TupleIndexOf
struct batt::TupleIndexOf< std::tuple<>, T >
struct batt::TupleIndexOf< std::tuple< T, Rest... >, T >
struct batt::TupleIndexOf< std::tuple< First, Rest... >, T >
struct batt::MapTuple
struct batt::MapTuple< PerTypeT, std::tuple< Ts... > >
class batt::StaticTypeMap
Stores a fixed-size set of Value objects, indexed by a set of bounded types (keys).
class batt::AbstractValue
class batt::AbstractValuePointer
class batt::TypeErasedStorageBase
class batt::TypeErasedStorage
class batt::AbstractValueImpl
struct batt::IsVariant
struct batt::IsVariant< std::variant< Ts... > >
struct batt::IsTuple
struct batt::IsTuple< std::tuple< Ts... > >
struct batt::StaticType
struct batt::StaticValue
struct batt::DecayRValueRefImpl
struct batt::Difference
Type trait that maps subtractable type T to the difference type.
struct batt::Difference< unsigned char >
struct batt::Difference< unsigned short >
struct batt::Difference< unsigned long >
struct batt::Difference< unsigned long long >
struct batt::Difference< std::pair< A, B > >
struct batt::Difference< std::tuple< Ts... > >
struct batt::UrlParse
struct batt::DefaultInitialized
A single type that implicitly converts to any default-constructible type (via batt::make_default()).

Types🔗

Name
enum StackType { kFixedSize = 0, kProtectedFixedSize = 1, kPooledFixedSize = 2, kMaxValue}
enum TransferStep { kNone, kFetch, kWrite}
enum int ReadWriteLockQueueNodeClass { kReading = 0, kWriting = 1}
enum bool WaitForResource { kFalse = false, kTrue = true}
enum i8 BoolStatus { kUnknown = -1, kFalse = 0, kTrue = 1}
An enumeration that models boolean (true/false) values plus unknown.
enum bool InclusiveLowerBound { kFalse = false, kTrue = true}
enum bool InclusiveUpperBound { kFalse = false, kTrue = true}
enum i8 Order { Less = -1, Equal = 0, Greater = 1}
enum int StatusCode { kOk = 0, kCancelled = 1, kUnknown = 2, kInvalidArgument = 3, kDeadlineExceeded = 4, kNotFound = 5, kAlreadyExists = 6, kPermissionDenied = 7, kResourceExhausted = 8, kFailedPrecondition = 9, kAborted = 10, kOutOfRange = 11, kUnimplemented = 12, kInternal = 13, kUnavailable = 14, kDataLoss = 15, kUnauthenticated = 16, kClosed = 100, kGrantUnavailable = 101, kLoopBreak = 102, kEndOfStream = 103, kClosedBeforeEndOfStream = 104, kGrantRevoked = 105, kPoke = 106}
enum ErrnoValue { }
enum StdGenericErrorCode { }
enum StdFutureErrorCode { }
enum StdSystemErrorCode { }
enum StdIostreamErrorCode { }
enum LogLevel { kFatal, kError, kWarning, kInfo, kDebug, kVerbose}
enum Pretty { True, False, Default}
using ::batt::StrongType< usize, PartsCount_TAG > PartsCount
using ::batt::StrongType< usize, PartSize_TAG > PartSize
using BasicRunningTotal< usize > RunningTotal
template <typename T >
using decltype(detail::has_const_buffer_sequence_requirements_impl< T >(nullptr))
HasConstBufferSequenceRequirements
template <typename T >
using std::enable_if_t< has_const_buffer_sequence_requirements< T >()>
EnableIfConstBufferSequence
template <typename T >
using decltype(detail::has_buffer_source_requirements_impl< T >(nullptr))
HasBufferSourceRequirements
template <typename T >
using std::enable_if_t< has_buffer_source_requirements< T >()>
EnableIfBufferSource
using boost::context::continuation Continuation
using ::batt::StrongType< usize, StackSize_TAG > StackSize
using BasicFakeExecutor< boost::asio::execution::outstanding_work_t::untracked_t > FakeExecutor
using ScalableGrant Grant
using boost::intrusive::slist_base_hook< boost::intrusive::cache_last< true >, boost::intrusive::constant_time_size< true > > DefaultHandlerBase
template <typename... Args>
using BasicAbstractHandler< DefaultHandlerBase, Args... >
AbstractHandler
template <typename HandlerFn ,typename... Args>
using BasicHandlerImpl< HandlerFn, DefaultHandlerBase, Args... >
HandlerImpl
template <typename Base ,typename... Args>
using boost::intrusive::slist< BasicAbstractHandler< Base, Args... >, boost::intrusive::cache_last< true >, boost::intrusive::constant_time_size< true > >
BasicHandlerList
template <typename... Args>
using BasicHandlerList< DefaultHandlerBase, Args... >
HandlerList
using boost::system::error_code ErrorCode
using BasicMCSMutex< false > MCSMutex
using BasicRateLimiter< std::chrono::steady_clock > RateLimiter
using BasicReadWriteLock< WatchAtomic > ReadWriteLock
template <typename T >
using ScopedReadWriteLockImpl< const T, ReadWriteLock::Reader >
ScopedReadLock
template <typename T >
using ScopedReadWriteLockImpl< T, ReadWriteLock::Writer >
ScopedWriteLock
using BasicExecutor< SimpleExecutionContext, boost::asio::execution::outstanding_work_t::untracked_t, boost::asio::execution::blocking_t::never_t, boost::asio::execution::relationship_t::fork_t > SimpleExecutor
using ::batt::StrongType< usize, TaskCount_TAG > TaskCount
using ::batt::StrongType< usize, InputSize_TAG > InputSize
using ::batt::StrongType< usize, TaskSize_TAG > TaskSize
using ::batt::StrongType< usize, TaskIndex_TAG > TaskIndex
using ::batt::StrongType< isize, TaskOffset_TAG > TaskOffset
using boost::asio::const_buffer ConstBuffer
using boost::asio::mutable_buffer MutableBuffer
using BasicHttpClientConnection< TcpTransport > HttpClientConnection
using BasicHttpClientConnection< SslTransport > HttpsClientConnection
using ::batt::StrongType< bool, IncludeHttpTrailer_TAG > IncludeHttpTrailer
using ::pico_http::MessageHeader HttpHeader
using SmallFn< Status(HttpRequest &request, HttpResponse &response)> HttpRequestDispatcherFn
One request dispatcher is created per accepted connection; it is reused in the context of that connection until the connection is closed.
using SmallFn< StatusOr< HttpRequestDispatcherFn >()> HttpRequestDispatcherFactoryFn
Called once per accepted connection.
template <typename T >
using BasicInterval< IClosedOpen< T > >
Interval
A half-open interval (like STL iterator ranges).
template <typename T >
using BasicInterval< IClosed< T > >
CInterval
A closed interval.
template <typename T >
using std::function< T()>
DerivedMetric
using std::vector< MetricLabel > MetricLabelSet
template <typename T >
using ScalarMetricExporter< CountMetric< T > >
CountMetricExporter
Exports a CountMetric.
template <typename T >
using ScalarMetricExporter< GaugeMetric< T > >
GaugeMetricExporter
Exports a GaugeMetric.
template <typename T >
using typename detail::NullableImpl< T >::type
Nullable
template <typename T >
using std::unique_ptr< T, NoopDeleter >
UniqueNonOwningPtr
template <typename T >
using decltype(detail::has_seq_requirements_impl< T >(nullptr))
HasSeqRequirements
template <typename T >
using std::enable_if_t< has_seq_requirements< T >()>
EnableIfSeq
template <typename T >
using typename SeqItem_Impl< T >::type
SeqItem
template <typename T >
using boost::intrusive_ref_counter< std::decay_t< T > >
RefCounted
template <typename T >
using decltype(detail::is_ref_counted_impl< std::decay_t< T > >(nullptr))
IsRefCounted
template <typename T >
using typename SharedPtrImpl< T >::type
SharedPtr
template <typename T >
using boost::iterator_range< T * >
Slice
template <typename Signature ,usize kMaxSize =kCpuCacheLineSize - sizeof(void*),bool kAllowAlloc =false>
using SmallFn< Signature, kMaxSize, true, kAllowAlloc >
UniqueSmallFn
A type-erased container for a move-only callable function-like object.
template <typename T ,usize kStaticSize =kDefaultSmallVecSize>
using boost::container::small_vector< T, kStaticSize >
SmallVec
template <typename T >
using boost::container::small_vector_base< T >
SmallVecBase
using void(*)(std::ostream &) PrintToStreamFunctionPointer
using BasicStateMachineEntropySource< std::function< usize(usize min_value, usize max_value)> > StateMachineEntropySource
template <typename T >
using detail::IsStatusOrImpl< std::decay_t< T > >
IsStatusOr
template <typename T >
using typename RemoveStatusOrImpl< std::decay_t< T > >::type
RemoveStatusOr
using boost::flyweights::flyweight< std::string, boost::flyweights::no_tracking > Token
template <template< typename... > class TemplateT,typename TupleT >
using typename MorphTuple< TemplateT, std::decay_t< TupleT > >::type
MorphTuple_t
template <template< typename > class PerTypeT,typename TupleT >
using typename MapTuple< PerTypeT, std::decay_t< TupleT > >::type
MapTuple_t
template <typename Fn ,typename... Args>
using decltype(detail::is_callable_impl< Fn, Args... >(nullptr))
IsCallable
template <typename T >
using decltype(detail::is_printable_impl< T >(nullptr))
IsPrintable
template <typename T >
using decltype(detail::is_range_impl< T >(nullptr))
IsRange
template <typename T ,typename... Args>
using std::enable_if_t<!std::is_same< std::tuple< std::decay_t< T > * >, std::tuple< std::decay_t< Args > ... > >{} &&!std::is_same< std::tuple<>, std::tuple< std::decay_t< Args > ... > >{} >
EnableIfNoShadow
template <typename T >
using typename DecayRValueRefImpl< T >::type
DecayRValueRef
template <typename T ,typename U =T>
using decltype(detail::can_be_eq_compared_helper< T, U >(nullptr, nullptr))
CanBeEqCompared
template <typename T >
using decltype(unwrap_ref(std::declval< T >()))
UnwrapRefType

Functions🔗

Name
template <typename Iter ,typename T ,typename BinaryOp >
Slice< T >
parallel_accumulate_partial(WorkContext & context, Iter first, Iter last, T init, const BinaryOp & binary_op, T identity, const Slice< T > & task_result_buffer, const WorkSliceParams & params)
template <typename Iter ,typename T ,typename BinaryOp >
T
parallel_accumulate(WorkerPool & worker_pool, Iter first, Iter last, T init, const BinaryOp & binary_op, T identity, TaskSize min_task_size =TaskSize{4096}, TaskCount max_tasks =TaskCount{std::thread::hardware_concurrency()})
template <typename Src ,typename Dst >
void
parallel_copy(WorkContext & work_context, Src src_begin, Src src_end, Dst dst_begin, TaskSize min_task_size, TaskCount max_tasks)
template <typename Src0 ,typename Src1 ,typename Dst ,typename Compare >
void
parallel_merge(WorkerPool & worker_pool, Src0 src_0_begin, Src0 src_0_end, Src1 src_1_begin, Src1 src_1_end, Dst dst_begin, Compare && compare, usize min_task_size =1400, usize max_tasks =std::thread::hardware_concurrency()/2)
template <typename Src0 ,typename Src1 ,typename Dst ,typename Compare >
void
parallel_merge(WorkContext & context, Src0 src_0_begin, Src0 src_0_end, Src1 src_1_begin, Src1 src_1_end, Dst dst_begin, Compare && compare, usize min_task_size =1400, usize max_tasks =std::thread::hardware_concurrency()/2)
template <typename Iter ,typename Fn ,typename ValueT =std::decay_t::reference>>>
BasicRunningTotal< ValueT >
parallel_running_total(WorkerPool & worker_pool, Iter first, Iter last, const Fn & fn, const WorkSliceParams & params)
template <typename Iter ,typename ValueT =typename std::iterator_traits::value_type>
BasicRunningTotal< ValueT >
parallel_running_total(WorkerPool & worker_pool, Iter first, Iter last, const WorkSliceParams & params)
template <typename Src ,typename Dst ,typename TransformFn >
void
parallel_transform(WorkContext & work_context, Src src_begin, Src src_end, Dst dst_begin, const TransformFn & transform_fn, TaskSize min_task_size, TaskCount max_tasks)
constexpr usize strong_typedef_default_value(PartsCount_TAG * )
constexpr usize strong_typedef_default_value(PartSize_TAG * )
void fail_check_exit()
std::atomic< bool > & fail_check_exit_entered()
std::atomic< bool > & fail_check_spin_lock()
template <typename... Ts>
bool
ignore(Ts && ...)
bool lock_fail_check_mutex()
template <typename BodyFn =void(),typename... TaskArgsAndHandler>
Task *
async_run_task(const boost::asio::any_io_executor & ex, StackSize stack_byte_size, BodyFn && body_fn, TaskArgsAndHandler &&... task_args_and_handler)
Creates and starts (default) a new batt::Task, the memory for which (including stack) is allocated as a single contiguous memory region using the allocated associated with the final arg passed to this function, the completion handler.
template <typename RetryPolicy ,typename ActionFn ,typename Result =std::invoke_result_t,typename SleepImpl =TaskSleepImpl,typename StatusIsRetryableImpl =DefaultStatusIsRetryableImpl>
Result
with_retry_policy(RetryPolicy && policy, std::string_view action_name, ActionFn && action_fn, SleepImpl && sleep_impl ={}, StatusIsRetryableImpl && status_is_retryable_impl ={})
void update_retry_state(RetryState & state, const ExponentialBackoff & policy)
template <typename T >
constexpr bool
has_const_buffer_sequence_requirements(StaticType< T > ={})
template <typename T >
constexpr bool
has_buffer_source_requirements(StaticType< T > ={})
template <typename Src ,typename =EnableIfBufferSource>
TakeNSource< Src >
**[operator
template <typename Src ,typename =EnableIfBufferSource>
void
**[operator
template <typename Src ,typename Fn ,typename =EnableIfBufferSource>
StatusOr< seq::LoopControl >
**[operator
template <typename Src ,typename =EnableIfBufferSource>
StatusOr< std::vector< char > >
**[operator
template <typename Src ,typename =EnableIfBufferSource>
Status
**[operator
template <typename Src ,typename =EnableIfBufferSource>
Status
**[operator
template <typename Src ,typename AsyncWriteStream ,typename =EnableIfBufferSource>
StatusOr< usize >
**[operator
template <typename Src ,typename ConstBufferSequence ,typename =EnableIfBufferSource,typename =EnableIfConstBufferSequence>
auto
**[operator
usize hash_value(const CancelToken & cancel_token)
CancelToken is hashed by its impl pointer.
bool operator==(const CancelToken & l, const CancelToken & r)
Returns true iff the two objects are copies of the same CancelToken.
bool operator!=(const CancelToken & l, const CancelToken & r)
bool operator<(const CancelToken & l, const CancelToken & r)
bool operator>(const CancelToken & l, const CancelToken & r)
bool operator<=(const CancelToken & l, const CancelToken & r)
bool operator>=(const CancelToken & l, const CancelToken & r)
template <typename T >
bool
is_cancelled(const CancelToken::HandlerImpl< T > & handler)
template <typename T >
bool
is_cancelled(const CustomAllocHandler< CancelToken::HandlerImpl< T >> & handler)
BATT_MAYBE_UNUSED ::batt::StaticBinaryAssertion< decltype(sizeof(void ) 2), decltype(sizeof(boost::context::stack_context)),(sizeof(void ) 2), ::batt::Eq,(sizeof(boost::context::stack_context)),((sizeof(void ) 2)==(sizeof(boost::context::stack_context)))> BOOST_PP_CAT(BOOST_PP_CAT(BATTERIES_StaticAssert_Instance_, LINE) , COUNTER )
constexpr usize strong_typedef_default_value(StackSize_TAG * )
template <typename T >
const StackAllocator &
get_stack_allocator_with_type(StackSize stack_size)
const StackAllocator & get_stack_allocator(StackSize stack_size, StackType stack_type)
template <typename Fn >
Continuation
callcc(StackAllocator && stack_allocator, Fn && fn)
template <typename Fn >
Continuation
callcc(StackSize stack_size, StackType stack_type, Fn && fn)
void this_task_debug_info(std::ostream & out)
void print_debug_info(DebugInfoFrame * p, std::ostream & out)
void print_all_threads_debug_info(std::ostream & out)
const char * shortened_source_file(const char * raw)
bool enable_dump_tasks()
template <typename OutstandingWorkP >
constexpr bool
operator==(const BasicFakeExecutor< OutstandingWorkP > & l, const BasicFakeExecutor< OutstandingWorkP > & r)
template <typename OutstandingWorkP >
constexpr bool
operator!=(const BasicFakeExecutor< OutstandingWorkP > & l, const BasicFakeExecutor< OutstandingWorkP > & r)
bool operator<(const FakeTimeService::TimerInstance & l, const FakeTimeService::TimerInstance & r)
bool operator>(const FakeTimeService::TimerInstance & l, const FakeTimeService::TimerInstance & r)
bool operator<=(const FakeTimeService::TimerInstance & l, const FakeTimeService::TimerInstance & r)
bool operator>=(const FakeTimeService::TimerInstance & l, const FakeTimeService::TimerInstance & r)
template <typename AsyncFetchStreamT ,typename ScopedChunk =BasicScopedChunk,typename ConstBufferSequence =typename AsyncFetchStreamT::const_buffers_type>
batt::StatusOr< ScopedChunk >
fetch_chunk(AsyncFetchStreamT & stream, usize min_size)
Awaits the result of an async_fetch on the passed stream with the given minimum chunk size.
template <typename From ,typename To >
StatusOr< usize >
transfer_chunked_data(From & from, To & to, TransferStep & step)
template <typename From ,typename To >
StatusOr< usize >
transfer_chunked_data(From & from, To & to)
Fetches data from the first arg and writes it to the second arg, until an error or end-of-file/stream occurs.
int futex_wait(std::atomic< u32 > * , u32 )
int futex_notify(std::atomic< u32 > * , u32 =1)
void spin_yield()
template <typename T >
Future< T >
get_future(const Promise< T > & promise)
Returns the Future object corresponding to the Promise.
BATT_MAYBE_UNUSED ::batt::StaticBinaryAssertion< decltype(sizeof(UniqueHandler<>)), decltype(sizeof(void )),(sizeof(UniqueHandler<>)), ::batt::Eq,(sizeof(void )),((sizeof(UniqueHandler<>))==(sizeof(void *)))> BOOST_PP_CAT(BOOST_PP_CAT(BATTERIES_StaticAssert_Instance_, LINE) , COUNTER )
template <typename Base ,typename... Args>
void
push_handler_prealloc(boost::intrusive::slist< BasicAbstractHandler< Base, Args... >, boost::intrusive::cache_last< true >, boost::intrusive::constant_time_size< true >> * list, BasicAbstractHandler< Base, Args... > * handler)
template <typename... Args,typename Base ,typename HandlerFn >
void
push_handler(boost::intrusive::slist< BasicAbstractHandler< Base, Args... >, boost::intrusive::cache_last< true >, boost::intrusive::constant_time_size< true >> * list, HandlerFn && fn)
template <typename... Params,typename... Args,typename Base >
void
invoke_all_handlers(boost::intrusive::slist< BasicAbstractHandler< Base, Params... >, boost::intrusive::cache_last< true >, boost::intrusive::constant_time_size< true >> * handlers, Args &&... args)
template <typename InnerFn ,typename OuterFn >
HandlerBinder< std::decay_t< InnerFn >, std::decay_t< OuterFn > >
bind_handler(InnerFn && inner, OuterFn && outer)
template <typename T ,typename U >
bool
operator==(const HandlerAllocator< T > & left, const HandlerAllocator< U > & right)
template <typename T ,typename U >
bool
operator!=(const HandlerAllocator< T > & left, const HandlerAllocator< U > & right)
template <typename Handler >
CustomAllocHandler< std::decay_t< Handler > >
make_custom_alloc_handler(HandlerMemoryBase & m, Handler && h)
Helper function to wrap a handler object to add custom allocation.
template <typename Handler ,typename... Args>
void
post_handler(Handler && handler, Args &&... args)
Posts a handler using its associated executor, binding its arguments.
template <typename... Ts>
std::ostream &
operator<<(std::ostream & out, const IOResult< Ts... > & t)
template <typename... Ts>
bool
is_ok_status(const IOResult< Ts... > & io_result)
bool is_ok_status(const ErrorCode & ec)
template <typename... Ts>
Status
to_status(const IOResult< Ts... > & io_result)
template <typename T >
void
pin_object(T * object)
template <typename T >
void
unpin_object(T * object)
template <typename T >
Pin< T >
make_pin(T * object)
template <typename T ,typename U >
bool
operator==(const Pin< T > & l, const Pin< U > & r)
template <typename T ,typename U >
bool
operator!=(const Pin< T > & l, const Pin< U > & r)
template <typename T >
bool
operator==(const Pin< T > & l, std::nullptr_t )
template <typename T >
bool
operator!=(const Pin< T > & l, std::nullptr_t )
template <typename U >
bool
operator==(std::nullptr_t , const Pin< U > & r)
template <typename U >
bool
operator!=(std::nullptr_t , const Pin< U > & r)
std::ostream & operator<<(std::ostream & out, const DumpReadWriteLockState & dump)
std::ostream & operator<<(std::ostream & out, ReadWriteLockQueueNodeClass t)
std::ostream & operator<<(std::ostream & out, const ScalableGrant & t)
constexpr usize strong_typedef_default_value(TaskCount_TAG * )
constexpr usize strong_typedef_default_value(InputSize_TAG * )
constexpr usize strong_typedef_default_value(TaskSize_TAG * )
constexpr usize strong_typedef_default_value(TaskIndex_TAG * )
constexpr isize strong_typedef_default_value(TaskOffset_TAG * )
template <typename Iter >
InputSize
get_input_size(const Iter & first, const Iter & last)
std::ostream & operator<<(std::ostream & out, const WorkSliceParams & t)
TaskSize get_task_size(const WorkSliceParams & params, InputSize input_size)
TaskCount get_task_count(InputSize input_size, TaskSize task_size)
std::ostream & operator<<(std::ostream & out, const WorkSlicePlan & t)
template <typename WorkFnGenerator >
Status
slice_work(WorkContext & context, const WorkSlicePlan & plan, WorkFnGenerator && gen_work_fn)
std::ostream & operator<<(std::ostream & out, const SpinGrant & t)
template <typename T >
StatusOr< std::reference_wrapper< StreamBuffer > >
operator<<(StatusOr< std::reference_wrapper< StreamBuffer >> stream_buffer, T && obj)
i32 next_thread_id()
Returns the lowest unused global thread id number; repeated calls to next_thread_id() will return monotonically increasing values.
i32 & this_thread_id()
Returns a reference to the thread-local id for the current thread.
std::ostream & operator<<(std::ostream & out, WaitForResource t)
template <typename T >
std::ostream &
operator<<(std::ostream & out, const Watch< T > & w)
Support for printing Watch to ostream.
template <typename T >
std::ostream &
operator<<(std::ostream & out, const WatchAtomic< T > & w)
Support for printing WatchAtomic to ostream.
constexpr BoolStatus bool_status_from(bool b)
Constructs a BoolStatus value from a bool.
constexpr BoolStatus **[operator
constexpr BoolStatus operator&&(BoolStatus left, BoolStatus right)
Performs a logical-and (conjunction) between two BoolStatus values.
constexpr BoolStatus operator!(BoolStatus b)
Performs a logical-not (negation) for the given BoolStatus value.
std::ostream & operator<<(std::ostream & out, const BoolStatus & t)
Prints a BoolStatus value.
i8 least_upper_bound(i8 n)
i8 greatest_lower_bound(i8 n)
i16 least_upper_bound(i16 n)
i16 greatest_lower_bound(i16 n)
i32 least_upper_bound(i32 n)
i32 greatest_lower_bound(i32 n)
i64 least_upper_bound(i64 n)
i64 greatest_lower_bound(i64 n)
u8 least_upper_bound(u8 n)
u8 greatest_lower_bound(u8 n)
u16 least_upper_bound(u16 n)
u16 greatest_lower_bound(u16 n)
u32 least_upper_bound(u32 n)
u32 greatest_lower_bound(u32 n)
u64 least_upper_bound(u64 n)
u64 greatest_lower_bound(u64 n)
template <typename T >
LeastUpperBound< std::decay_t< T > >
least_upper_bound(T && value)
template <typename T ,typename U >
bool
operator<(const T & left, const LeastUpperBound< U > & right)
template <typename T ,typename U >
bool
operator<(const LeastUpperBound< T > & left, const U & right)
template <typename T ,typename U >
bool
operator<(const LeastUpperBound< T > & left, const LeastUpperBound< U > & right)
template <typename T ,typename U >
bool
operator==(const T & , const LeastUpperBound< U > & )
template <typename T ,typename U >
bool
operator==(const LeastUpperBound< T > & , const U & )
template <typename T ,typename U >
bool
operator==(const LeastUpperBound< T > & left, const LeastUpperBound< U > & right)
template <typename T ,typename U >
bool
operator>(const T & l, const LeastUpperBound< U > & r)
template <typename T ,typename U >
bool
operator<=(const T & l, const LeastUpperBound< U > & r)
template <typename T ,typename U >
bool
operator>=(const T & l, const LeastUpperBound< U > & r)
template <typename T ,typename U >
bool
operator>(const LeastUpperBound< T > & l, const U & r)
template <typename T ,typename U >
bool
operator<=(const LeastUpperBound< T > & l, const U & r)
template <typename T ,typename U >
bool
operator>=(const LeastUpperBound< T > & l, const U & r)
template <typename T ,typename U >
bool
operator>(const LeastUpperBound< T > & l, const LeastUpperBound< U > & r)
template <typename T ,typename U >
bool
operator<=(const LeastUpperBound< T > & l, const LeastUpperBound< U > & r)
template <typename T ,typename U >
bool
operator>=(const LeastUpperBound< T > & l, const LeastUpperBound< U > & r)
template <typename T ,typename U >
bool
operator!=(const T & l, const LeastUpperBound< U > & r)
template <typename T ,typename U >
bool
operator!=(const LeastUpperBound< T > & l, const U & r)
template <typename T ,typename U >
bool
operator!=(const LeastUpperBound< T > & l, const LeastUpperBound< U > & r)
template <typename T ,typename U >
GreatestLowerBound< std::decay_t< T > >
greatest_lower_bound(T && value)
template <typename T ,typename U >
bool
operator<(const T & left, const GreatestLowerBound< U > & right)
template <typename T ,typename U >
bool
operator<(const GreatestLowerBound< T > & left, const U & right)
template <typename T ,typename U >
bool
operator<(const GreatestLowerBound< T > & left, const GreatestLowerBound< U > & right)
template <typename T ,typename U >
bool
operator==(const T & , const GreatestLowerBound< U > & )
template <typename T ,typename U >
bool
operator==(const GreatestLowerBound< T > & , const U & )
template <typename T ,typename U >
bool
operator==(const GreatestLowerBound< T > & left, const GreatestLowerBound< U > & right)
template <typename T ,typename U >
bool
operator>(const T & l, const GreatestLowerBound< U > & r)
template <typename T ,typename U >
bool
operator<=(const T & l, const GreatestLowerBound< U > & r)
template <typename T ,typename U >
bool
operator>=(const T & l, const GreatestLowerBound< U > & r)
template <typename T ,typename U >
bool
operator>(const GreatestLowerBound< T > & l, const U & r)
template <typename T ,typename U >
bool
operator<=(const GreatestLowerBound< T > & l, const U & r)
template <typename T ,typename U >
bool
operator>=(const GreatestLowerBound< T > & l, const U & r)
template <typename T ,typename U >
bool
operator>(const GreatestLowerBound< T > & l, const GreatestLowerBound< U > & r)
template <typename T ,typename U >
bool
operator<=(const GreatestLowerBound< T > & l, const GreatestLowerBound< U > & r)
template <typename T ,typename U >
bool
operator>=(const GreatestLowerBound< T > & l, const GreatestLowerBound< U > & r)
template <typename T ,typename U >
bool
operator!=(const T & l, const GreatestLowerBound< U > & r)
template <typename T ,typename U >
bool
operator!=(const GreatestLowerBound< T > & l, const U & r)
template <typename T ,typename U >
bool
operator!=(const GreatestLowerBound< T > & l, const GreatestLowerBound< U > & r)
template <typename... Args>
decltype(auto)
make_buffer(Args &&... args)
template <typename T >
ConstBuffer
buffer_from_struct(const T & val)
std::string_view as_str(const ConstBuffer & buffer)
Converts a ConstBuffer into an equivalent std::string_view.
template <typename T >
std::string_view
bytes_from_struct(const T & val)
Returns a std::string_view with the same size and data address as the passed object, as if the address of val had been reinterpret_cast to type const char*.
template <typename T >
MutableBuffer
mutable_buffer_from_struct(T & val)
ConstBuffer resize_buffer(const ConstBuffer & b, usize s)
MutableBuffer resize_buffer(const MutableBuffer & b, usize s)
template <typename SizeT >
ConstBuffer
slice_buffer(const ConstBuffer & b, const Interval< SizeT > & slice)
Select a subset of the passed buffer according to the passed interval.
template <typename SizeT >
MutableBuffer
slice_buffer(const MutableBuffer & b, const Interval< SizeT > & slice)
Select a subset of the passed buffer according to the passed interval.
template <typename VecT >
void
consume_buffers(VecT & buffers, usize count)
template <typename Iter >
std::pair< Iter, usize >
consume_buffers_iter(const std::pair< Iter, usize > & pos, const Iter & last, usize count)
template <typename VecT >
VecT
consume_buffers_copy(const VecT & buffers, usize count)
template <usize kLength,usize... kIndex>
constexpr std::array< char, kLength - 1 >
array_from_c_str(const char(&) c_str[kLength], std::index_sequence< kIndex... > )
Converts a compile-time string constant to std::array, automatically inferring the string length (without the null-terminator).
template <usize kLength>
constexpr std::array< char, kLength - 1 >
array_from_c_str(const char(&) c_str[kLength])
Converts a compile-time string constant to std::array, automatically inferring the string length (without the null-terminator).
ConstBuffer as_const_buffer(const ConstBuffer & buffer)
ConstBuffer as_const_buffer(const MutableBuffer & buffer)
ConstBuffer as_const_buffer(const std::string_view & str)
ConstBuffer as_const_buffer(const std::string & str)
template <usize kSize>
ConstBuffer
as_const_buffer(const std::array< char, kSize > & arr)
template <usize kSize>
ConstBuffer
as_const_buffer(const std::array< u8, kSize > & arr)
ConstBuffer as_const_buffer(const std::vector< char > & vec)
ConstBuffer as_const_buffer(const std::vector< u8 > & vec)
ConstBuffer as_const_buffer(const SmallVecBase< char > & vec)
ConstBuffer as_const_buffer(const SmallVecBase< u8 > & vec)
template <usize kLength>
ConstBuffer
as_const_buffer(const char(&) c_str[kLength])
template <typename... Cases>
CaseOfVisitor< Cases &&... >
make_case_of_visitor(Cases &&... cases)
Constructs and returns a single overloaded callable function object that forwards its arguments on to the first object in cases that is callable with those arguments.
template <typename VarType ,typename... Cases>
decltype(auto)
case_of(VarType && v, Cases &&... cases)
Matches a variant against a list of callables and apply the first one that will accept the current value.
template <typename T ,typename Var >
bool
is_case(Var && v)
template <typename ToType ,typename FromType ,typename =std::enable_if_t == std::is_signed_v\>>
ToType
checked_cast(FromType val, const char * file ="", int line =0)
template <typename ToType ,typename FromType ,typename =std::enable_if_t && !std::is_signed_v\>,typename =void>
ToType
checked_cast(FromType val, const char * file ="", int line =0)
template <typename ToType ,typename FromType ,typename =std::enable_if_t<!std::is_signed_v && std::is_signed_v>,typename =void,typename =void>
ToType
checked_cast(FromType val, const char * file ="", int line =0)
std::ostream & operator<<(std::ostream & out, Order t)
Order compare(const std::string_view & a, const std::string_view & b)
template <typename T >
std::ostream &
operator<<(std::ostream & out, const CpuCacheLineIsolated< T > & t)
Status pin_thread_to_cpu(usize cpu_i)
template <typename IntRange >
Status
pin_thread_to_cpu_set(const IntRange & cpu_i_set)
Status pin_thread_i_of_config(usize i, const ThreadPoolConfig & config, const std::string_view & pool_name ="")
template <typename... Args>
constexpr void
do_nothing(Args && ...)
bool big_endian_less_than(BOOST_PP_CAT(u, 16) a, BOOST_PP_CAT(u, 16) b)
bool big_endian_less_than(BOOST_PP_CAT(u, 32) a, BOOST_PP_CAT(u, 32) b)
bool big_endian_less_than(BOOST_PP_CAT(u, 64) a, BOOST_PP_CAT(u, 64) b)
template <typename T >
Optional< T >
getenv_as(const char * var_name)
Parse environment variable as a given type T.
template <typename Fn >
auto
finally(Fn && fn)
usize hash()
template <typename T >
usize
hash(T && obj)
template <typename T ,typename HashT =typename std::decay_t::Hash>
usize
hash_value(T && obj)
template <typename First ,typename... Rest>
usize
hash(First && first, Rest &&... rest)
StatusOr< SmallVec< boost::asio::ip::tcp::endpoint > > await_resolve(boost::asio::ip::tcp::resolver & resolver, const HostAddress & host_address)
StatusOr< SmallVec< boost::asio::ip::tcp::endpoint > > await_resolve(boost::asio::io_context & io, const HostAddress & host_address)
usize hash_value(const HostAddress & host_key)
bool operator==(const HostAddress & l, const HostAddress & r)
bool operator!=(const HostAddress & l, const HostAddress & r)
std::ostream & operator<<(std::ostream & out, const HostAddress & t)
template <typename Src ,typename AsyncWriteStream >
Status
http_encode_chunked(Src && src, AsyncWriteStream && dst, IncludeHttpTrailer include_trailer =IncludeHttpTrailer{false})
template <typename... Params>
StatusOr< std::unique_ptr< HttpResponse > >
http_request(std::string_view method, std::string_view url, Params &&... params)
Submits an HTTP request, returning the response object.
template <typename... Params>
StatusOr< std::unique_ptr< HttpResponse > >
http_get(std::string_view url, Params &&... params)
template <typename... Params>
StatusOr< std::unique_ptr< HttpResponse > >
http_post(std::string_view url, Params &&... params)
template <typename... Params>
StatusOr< std::unique_ptr< HttpResponse > >
http_put(std::string_view url, Params &&... params)
template <typename... Params>
StatusOr< std::unique_ptr< HttpResponse > >
http_delete(std::string_view url, Params &&... params)
constexpr bool strong_typedef_default_value(IncludeHttpTrailer_TAG * )
Optional< std::string_view > find_header(const SmallVecBase< HttpHeader > & headers, const std::string_view & name)
std::ostream & operator<<(std::ostream & out, const HttpMessageInfo & t)
template <typename TraitsT ,typename DeltaT >
BasicInterval< TraitsT >
push_back(const BasicInterval< TraitsT > & i, DeltaT delta)
template <typename TraitsT ,typename DeltaT >
BasicInterval< TraitsT >
push_front(const BasicInterval< TraitsT > & i, DeltaT delta)
template <typename TraitsT ,typename DeltaT >
BasicInterval< TraitsT >
pop_back(const BasicInterval< TraitsT > & i, DeltaT delta)
template <typename TraitsT ,typename DeltaT >
BasicInterval< TraitsT >
pop_front(const BasicInterval< TraitsT > & i, DeltaT delta)
template <typename T ,typename U >
BasicInterval< IClosedOpen< std::decay_t< T >, std::decay_t< U > > >
make_interval(T && lower, U && upper)
template <typename TraitsL ,typename TraitsR >
bool
operator==(const BasicInterval< TraitsL > & l, const BasicInterval< TraitsR > & r)
template <typename TraitsL ,typename TraitsR >
bool
operator!=(const BasicInterval< TraitsL > & l, const BasicInterval< TraitsR > & r)
template <typename Traits >
std::ostream &
operator<<(std::ostream & out, const BasicInterval< Traits > & t)
template <typename Traits0 ,typename Traits1 >
constexpr bool
interval_traits_compatible()
template <typename T ,typename =std::enable_if_t{}>>
decltype(auto)
make_printable(T && obj)
Returns a std::ostream-printable representation of the argument, obj.
template <typename T ,typename =std::enable_if_t<!IsPrintable{}>,typename =void>
std::string
make_printable(T && obj)
Returns a std::ostream-printable representation of the argument, obj.
constexpr i32 log2_ceil(u64 i)
Returns log_2(i), rounded down to the nearest integer.
constexpr i32 log2_floor(u64 i)
Returns log_2(i), rounded down to the nearest integer.
template <typename IntT >
constexpr IntT
lsb_mask(i32 bits)
Least Significant Bits Mask.
template <typename IntT >
constexpr IntT
round_down_bits(i32 bits, IntT n)
Rounds an integer value down to the nearest multiple of 2^bits.
template <typename IntT >
constexpr IntT
round_up_bits(i32 bits, IntT n)
Rounds an integer value up to the nearest multiple of 2^bits.
template <typename IntT >
constexpr IntT
round_down_to(IntT unit, IntT n)
Rounds n down to the nearest multiple of unit.
template <typename IntT >
constexpr IntT
round_up_to(IntT unit, IntT n)
Rounds n up to the nearest multiple of unit.
template <typename IntT >
constexpr IntT
ipow(IntT base, IntT exponent, IntT accumulator =static_cast< IntT >(1))
Compile-time integer exponentiation.
i32 bit_count(u64 n)
Returns the number of set (1) bits in the passed integer.
std::ostream & operator<<(std::ostream & out, const LatencyMetric & t)
MetricLabelSet normalize_labels(MetricLabelSet && labels)
MetricRegistry & global_metric_registry()
template <typename T >
auto
make_nullable(T && obj)
bool operator==(const NoneType & , const NoneType & )
bool operator!=(const NoneType & , const NoneType & )
template <typename T0 ,typename T1 >
bool
operator==(const Optional< T0 > & v0, const Optional< T1 > & v1)
template <typename T0 ,typename T1 >
bool
operator!=(const Optional< T0 > & v0, const Optional< T1 > & v1)
template <typename T0 ,typename T1 >
bool
operator==(const Optional< T0 > & v0, const T1 & v1)
template <typename T0 ,typename T1 >
bool
operator!=(const Optional< T0 > & v0, const T1 & v1)
template <typename T0 ,typename T1 >
bool
operator==(const T0 & v0, const Optional< T1 > & v1)
template <typename T0 ,typename T1 >
bool
operator!=(const T0 & v0, const Optional< T1 > & v1)
template <typename T >
bool
operator==(NoneType , const Optional< T > & v)
template <typename T >
bool
operator!=(NoneType , const Optional< T > & v)
template <typename T >
bool
operator==(const Optional< T > & v, NoneType )
template <typename T >
bool
operator!=(const Optional< T > & v, NoneType )
template <typename T >
std::ostream &
operator<<(std::ostream & out, const Optional< T > & t)
std::ostream & operator<<(std::ostream & out, const NoneType & )
template <typename T >
Optional< std::decay_t< T > >
make_optional(T && val)
template <typename T >
decltype(auto)
get_or_panic(Optional< T > & opt)
template <typename T >
decltype(auto)
get_or_panic(const Optional< T > & opt)
template <typename T >
decltype(auto)
get_or_panic(Optional< T > && opt)
template <usize N_>
std::ostream &
operator<<(std::ostream & out, const RadixQueue< N_ > & t)
template <typename T >
std::ostream &
operator<<(std::ostream & out, const Ref< T > & t)
template <typename T >
Ref< T >
as_ref(T & obj_ref)
template <typename T >
Ref< const T >
as_cref(const T & obj_ref)
template <typename T >
Ref< T >
into_ref(T * ptr)
template <typename T >
Ref< const T >
into_cref(const T * ptr)
template <typename T >
decltype(auto)
unwrap_ref(Ref< T > & wrapper)
template <typename T >
decltype(auto)
unwrap_ref(Ref< T > const & wrapper)
template <typename T >
decltype(auto)
unwrap_ref(Ref< T > && wrapper)
template <typename T >
decltype(auto)
unwrap_ref(Ref< T > const && wrapper)
bool & print_stack_trace_atexit_enabled()
void print_stack_trace_atexit()
template <typename T >
constexpr bool
has_seq_requirements(StaticType< T > ={})
SkipNBinder skip_n(usize n)
template <typename Seq ,typename =EnableIfSeq>
SkipN< Seq >
**[operator
template <typename T ,typename =decltype(std::declval().front()),typename =decltype(std::declval().drop_front())>
SubRangeSeq< T >
as_seq(T && sub_range)
template <typename ForwardIter >
auto
as_seq(ForwardIter && begin, ForwardIter && end)
template <typename VectorLike ,typename =decltype(std::declval().data()),typename =decltype(std::declval().size())>
auto
as_seq(VectorLike && v)
template <typename T ,typename Begin =decltype(std::declval().data()),typename End =decltype(std::declval() + std::declval().size()),typename =std::enable_if_t>>
auto
vec_range(const T & vec)
template <typename T >
auto
into_seq(std::vector< T > && v)
template <typename SeqT >
SeqRef< SeqT >
seq_ref(SeqT & seq)
template <typename T ,typename... Args,typename =std::enable_if_t{}>>
SharedPtr< T >
make_shared(Args &&... args)
template <typename T ,typename... Args,typename =std::enable_if_t<!IsRefCounted{}>,typename =void>
SharedPtr< T >
make_shared(Args &&... args)
template <typename T >
SharedPtr< T >
into_shared(std::unique_ptr< T > && ptr)
template <typename T ,typename =std::enable_if_t< std::is_same_v, std::shared_ptr\>>>>
SharedPtr< T >
shared_ptr_from(T * that)
template <typename T ,typename =std::enable_if_t< std::is_same_v, boost::intrusive_ptr\>>>,typename =void>
SharedPtr< T >
shared_ptr_from(T * that)
template <typename T ,typename DataT =decltype(std::declval().data()),typename =std::enable_if_t>,typename ElementT =typename std::pointer_traits::element_type>
Slice< ElementT >
as_slice(T && container)
template <typename ElementT >
Slice< ElementT >
as_slice(ElementT * begin, ElementT * end)
template <typename ElementT >
Slice< ElementT >
as_slice(ElementT * begin, usize size)
template <typename ElementT >
Slice< ElementT >
as_slice(const Slice< ElementT > & slice)
template <typename ElementT >
Slice< const ElementT >
as_const_slice(const ElementT * begin, const ElementT * end)
template <typename ElementT >
Slice< const ElementT >
as_const_slice(const ElementT * begin, usize size)
template <typename T ,typename DataT =decltype(std::declval().data()),typename =std::enable_if_t>,typename ElementT =typename std::pointer_traits::element_type>
Slice< const ElementT >
as_const_slice(const T & container)
template <typename ElementT >
Slice< ElementT >
empty_slice(StaticType< ElementT > ={})
template <typename T >
SubRangeSeq< Slice< T > >
as_seq(const Slice< T > & s)
template <typename T >
auto
as_seq(Slice< T > & s)
template <typename T >
auto
as_seq(Slice< T > && s)
template <typename T >
auto
as_seq(const Slice< T > && s)
template <typename Iter >
boost::iterator_range< Iter >
as_range(const std::pair< Iter, Iter > & p)
template <typename RangeT ,typename Iter =std::decay_t()))>,typename OffsetT ,typename =std::enable_if_t>>
boost::iterator_range< Iter >
slice_range(RangeT && range, const Interval< OffsetT > & i)
void copy_string(SmallVecBase< char > & dst, const std::string_view & src)
std::string_view as_str(const SmallVecBase< char > & v)
std::atomic< PrintToStreamFunctionPointer > & extra_segv_debug_info_callback()
void print_stack_trace()
template <typename StateT ,typename StateHash ,typename StateEqual >
std::ostream &
operator<<(std::ostream & out, const StateMachineBranch< StateT, StateHash, StateEqual > & t)
template <typename StateT ,typename StateHash ,typename StateEqual >
bool
operator==(const StateMachineBranch< StateT, StateHash, StateEqual > & l, const StateMachineBranch< StateT, StateHash, StateEqual > & r)
template <typename StateT ,typename StateHash ,typename StateEqual >
usize
hash_value(const StateMachineBranch< StateT, StateHash, StateEqual > & branch)
StateMachineResult combine_results(const StateMachineResult & a, const StateMachineResult & b)
std::ostream & operator<<(std::ostream & out, const StateMachineResult & r)
template <typename IntT ,IntT kBegin,IntT kEnd,typename Fn ,typename R =decltype(std::declval()(std::integral_constant{}))>
R
static_dispatch(IntT i, Fn && fn)
template <typename Fn >
decltype(auto)
static_dispatch(bool b, Fn && fn)
template <typename Tuple ,typename Fn >
decltype(auto)
static_dispatch(std::size_t i, Fn && fn)
std::ostream & operator<<(std::ostream & out, const Status & t)
bool operator==(const Status & l, const Status & r)
bool operator!=(const Status & l, const Status & r)
Status OkStatus()
template <typename T ,typename U ,typename =std::enable_if_t{}>>
bool
operator==(const StatusOr< T > & l, const StatusOr< U > & r)
template <typename T ,typename U ,typename =std::enable_if_t<!CanBeEqCompared{}>,typename =void>
bool
operator==(const StatusOr< T > & l, const StatusOr< U > & r)
template <typename T ,typename U >
bool
operator!=(const StatusOr< T > & l, const StatusOr< U > & r)
bool is_ok_status(const std::error_code & ec)
template <typename T >
bool
is_ok_status(const T & val)
std::ostream & operator<<(std::ostream & out, LogLevel t)
std::atomic< LogLevel > & require_fail_global_default_log_level()
Optional< LogLevel > & require_fail_thread_default_log_level()
Status status_from_errno(int code)
template <typename T ,typename =std::enable_if_t{} && !std::is_same_v\, StatusOr\>>>
decltype(auto)
to_status(T && v)
template <typename T ,typename =std::enable_if_t<std::is_same_v, Status>
template <typename EnumT >
bool
register_error_category(const boost::system::error_category & category, const std::vector< EnumT > & codes, batt::StaticType< EnumT > ={})
Registers a custom error_category so that error_code objects that use it can be converted to batt::Status via batt::to_status.
Status status_from_error_category(const boost::system::error_category & category, int code)
Constructs and returns a batt::Status equivalent to the given code in the given category.
Status status_from_error_code(const boost::system::error_code & ec)
Constructs and returns a batt::Status equivalent to the given error_code.
Status error_code_to_status(const std::error_code & ec)
Status error_code_to_status(const boost::system::error_code & ec)
template <typename T ,typename =std::enable_if_t<std::is_same_v, std::error_code>
template <typename T ,typename =std::enable_if_t<std::is_same_v, boost::asio::error::basic_errors>
template <typename T >
Status
status_from_retval(T retval)
template <typename T >
T &&
ok_result_or_panic(StatusOr< T > && result)
template <typename T ,typename =std::enable_if_t>{} && !std::is_same_v\, StatusOr\>>>
std::ostream &
operator<<(std::ostream & out, T && status_or)
bool status_is_retryable(const Status & s)
std::ostream & print_all(std::ostream & out)
template <typename First ,typename... Rest>
std::ostream &
print_all(std::ostream & out, First && first, Rest &&... rest)
std::istream & extract_all(std::istream & in)
template <typename First ,typename... Rest>
std::istream &
extract_all(std::istream & in, First && first, Rest &&... rest)
template <typename... Args>
std::string
to_string(Args &&... args)
template <typename T ,typename... FormatArgs>
std::optional< T >
from_string(const std::string & str, FormatArgs &&... format_args)
EscapedStringLiteral c_str_literal(const std::string_view & str)
template <typename T ,typename =std::enable_if_t>>
Optional< EscapedStringLiteral >
c_str_literal(const Optional< T > & maybe_str)
Optional< EscapedStringLiteral > c_str_literal(const NoneType & )
decltype(auto) make_printable(std::string & str)
decltype(auto) make_printable(std::string && str)
decltype(auto) make_printable(const std::string & str)
decltype(auto) make_printable(const std::string && str)
decltype(auto) make_printable(std::string_view & str)
decltype(auto) make_printable(std::string_view && str)
decltype(auto) make_printable(const std::string_view & str)
decltype(auto) make_printable(const std::string_view && str)
const std::string_view & StringUpperBound()
std::ostream & operator<<(std::ostream & out, const EscapedStringLiteral & t)
std::ostream & operator<<(std::ostream & out, const HexByteDumper & t)
HexByteDumper dump_hex(const void * ptr, usize size)
std::ostream & operator<<(std::ostream & out, SizeDumper t)
SizeDumper dump_size(usize n)
SizeDumper dump_size_exact(usize n)
Optional< usize > parse_byte_size(std::string_view s)
Parse a byte size string with optional units.
template <typename T >
RangeDumper< const T & >
dump_range(const T & value, Pretty pretty =Pretty::Default)
auto pretty_print_indent()
template <typename T >
constexpr bool
is_strong_type(StaticType< T > ={})
template <typename T ,typename Tag ,typename =std::enable_if_t>
constexpr StrongType< T, Tag >
operator+(StrongType< T, Tag > a, StrongType< T, Tag > b)
template <typename T ,typename Tag ,typename =std::enable_if_t>
constexpr StrongType< T, Tag >
operator-(StrongType< T, Tag > a, StrongType< T, Tag > b)
template <typename T ,typename Tag ,typename =std::enable_if_t>
constexpr StrongType< T, Tag >
operator*(StrongType< T, Tag > a, StrongType< T, Tag > b)
template <typename T ,typename Tag ,typename =std::enable_if_t>
constexpr StrongType< T, Tag >
operator/(StrongType< T, Tag > a, StrongType< T, Tag > b)
template <typename Op >
auto
syscall_retry(Op && op)
template <typename L ,typename R >
constexpr bool
operator==(StaticType< L > , StaticType< R > )
template <typename L ,typename R >
constexpr bool
operator!=(StaticType< L > , StaticType< R > )
constexpr bool is_any_true()
Returns true iff any of the passed arguments evaluates to true (base case; always returns false).
template <typename... Rest>
constexpr bool
is_any_true(bool first, Rest &&... rest)
Returns true iff any of the passed arguments evaluates to true (recursive case; short circuits if first is true.).
constexpr bool are_all_true()
Returns true iff all of the passed arguments evaluate to true (base case; always returns false).
template <typename... Rest>
constexpr bool
are_all_true(bool first, Rest &&... rest)
Returns true iff any of the passed arguments evaluates to true (recursive case; short circuits if first is true.).
const char * name_of(const std::type_index & index)
Calculates and returns the demangled name of the given type as a null-terminated C-string.
const char * name_of(const std::type_info & info)
Calculates and returns the demangled name of the given type as a null-terminated C-string.
template <typename T >
const char *
name_of(batt::StaticType< T > ={})
Calculates and returns the demangled name of the given type as a null-terminated C-string.
template <typename T >
const char *
unqualified_name_of(batt::StaticType< T > ={})
Calculates and returns the demangled name of the given type, without the namespace qualifier.
template <typename T ,typename =std::enable_if_t>>
constexpr auto
can_be_empty_base(StaticType< T > ={})
Returns true iff the specified type can be optimized to zero size via empty base class optimization.
template <typename T ,typename =std::enable_if_t<!std::is_class_v>,typename =void>
constexpr std::false_type
can_be_empty_base(StaticType< T > ={})
bool operator==(const UrlParse & left, const UrlParse & right)
bool operator!=(const UrlParse & left, const UrlParse & right)
std::ostream & operator<<(std::ostream & out, const UrlParse & t)
StatusOr< UrlParse > parse_url(std::string_view url)
template <typename T >
T
make_copy(const T & value)
Return a copy of value.
template <typename T ,typename =std::enable_if_t>>>
T &&
sink(T && value)
template <typename T >
T
sink(const T & value)
template <typename T ,typename =std::enable_if_t<!std::is_same_v>>
T
make_default()
Return a default-constructed instance of type T.
template <typename T ,typename =std::enable_if_t>,typename =void>
void
make_default()
template <typename T >
decltype(auto)
unwrap_ref(T && obj)
template <typename T >
decltype(auto)
unwrap_ref(std::reference_wrapper< T > & wrapper)
template <typename T >
decltype(auto)
unwrap_ref(std::reference_wrapper< T > const & wrapper)
template <typename T >
decltype(auto)
unwrap_ref(std::reference_wrapper< T > && wrapper)
template <typename T >
decltype(auto)
unwrap_ref(std::reference_wrapper< T > const && wrapper)
template <typename Fn ,typename... Args>
decltype(auto)
rotate_args_right(Fn && fn, Args &&... args)
template <typename Fn ,typename... Args>
decltype(auto)
rotate_args_left(Fn && fn, Args &&... args)

Attributes🔗

Name
constexpr usize kMinStackSizeLog2
constexpr usize kMaxStackSizeLog2
constexpr usize kMaxDebugInfoThreads
const bool kTaskDebugInfoSegvCallbackInstalled
constexpr auto kCpuCacheLineSize
const bool kSigSegvHandlerInstalled
constexpr usize kDefaultSmallVecSize
constexpr bool IsStatusEnum
constexpr auto TupleIndexOf_v
constexpr bool IsOneOf
Trait that evaluates to true iff T is the same as one of the MatchTs.
constexpr bool DecaysToOneOf
Trait that evaluates to true iff T decays to one of the MatchTs.

Types Documentation🔗

enum StackType🔗

Enumerator Value Description
kFixedSize 0
kProtectedFixedSize 1
kPooledFixedSize 2
kMaxValue

enum TransferStep🔗

Enumerator Value Description
kNone
kFetch
kWrite

enum ReadWriteLockQueueNodeClass🔗

Enumerator Value Description
kReading 0
kWriting 1

enum WaitForResource🔗

Enumerator Value Description
kFalse false
kTrue true

enum BoolStatus🔗

Enumerator Value Description
kUnknown -1
kFalse 0
kTrue 1

An enumeration that models boolean (true/false) values plus unknown.

enum InclusiveLowerBound🔗

Enumerator Value Description
kFalse false
kTrue true

enum InclusiveUpperBound🔗

Enumerator Value Description
kFalse false
kTrue true

enum Order🔗

Enumerator Value Description
Less -1
Equal 0
Greater 1

enum StatusCode🔗

Enumerator Value Description
kOk 0
kCancelled 1
kUnknown 2
kInvalidArgument 3
kDeadlineExceeded 4
kNotFound 5
kAlreadyExists 6
kPermissionDenied 7
kResourceExhausted 8
kFailedPrecondition 9
kAborted 10
kOutOfRange 11
kUnimplemented 12
kInternal 13
kUnavailable 14
kDataLoss 15
kUnauthenticated 16
kClosed 100
kGrantUnavailable 101
kLoopBreak 102
kEndOfStream 103
kClosedBeforeEndOfStream 104
kGrantRevoked 105
kPoke 106

enum ErrnoValue🔗

Enumerator Value Description

enum StdGenericErrorCode🔗

Enumerator Value Description

enum StdFutureErrorCode🔗

Enumerator Value Description

enum StdSystemErrorCode🔗

Enumerator Value Description

enum StdIostreamErrorCode🔗

Enumerator Value Description

enum LogLevel🔗

Enumerator Value Description
kFatal
kError
kWarning
kInfo
kDebug
kVerbose

enum Pretty🔗

Enumerator Value Description
True
False
Default

using PartsCount🔗

using batt::PartsCount = typedef ::batt::StrongType< usize , PartsCount_TAG >;

using PartSize🔗

using batt::PartSize = typedef ::batt::StrongType< usize , PartSize_TAG >;

using RunningTotal🔗

using batt::RunningTotal = typedef BasicRunningTotal<usize>;

using HasConstBufferSequenceRequirements🔗

template <typename T >
using batt::HasConstBufferSequenceRequirements = typedef decltype(detail::has_const_buffer_sequence_requirements_impl<T>(nullptr));

using EnableIfConstBufferSequence🔗

template <typename T >
using batt::EnableIfConstBufferSequence = typedef std::enable_if_t<has_const_buffer_sequence_requirements<T>()>;

using HasBufferSourceRequirements🔗

template <typename T >
using batt::HasBufferSourceRequirements = typedef decltype(detail::has_buffer_source_requirements_impl<T>(nullptr));

using EnableIfBufferSource🔗

template <typename T >
using batt::EnableIfBufferSource = typedef std::enable_if_t<has_buffer_source_requirements<T>()>;

using Continuation🔗

using batt::Continuation = typedef boost::context::continuation;

using StackSize🔗

using batt::StackSize = typedef ::batt::StrongType< usize , StackSize_TAG >;

using FakeExecutor🔗

using batt::FakeExecutor = typedef BasicFakeExecutor<boost::asio::execution::outstanding_work_t::untracked_t>;

using Grant🔗

using batt::Grant = typedef ScalableGrant;

using DefaultHandlerBase🔗

using batt::DefaultHandlerBase = typedef boost::intrusive::slist_base_hook<boost::intrusive::cache_last<true>, boost::intrusive::constant_time_size<true> >;

using AbstractHandler🔗

template <typename... Args>
using batt::AbstractHandler = typedef BasicAbstractHandler<DefaultHandlerBase, Args...>;

using HandlerImpl🔗

1
2
3
template <typename HandlerFn ,
typename... Args>
using batt::HandlerImpl = typedef BasicHandlerImpl<HandlerFn, DefaultHandlerBase, Args...>;

using BasicHandlerList🔗

1
2
3
template <typename Base ,
typename... Args>
using batt::BasicHandlerList = typedef boost::intrusive::slist<BasicAbstractHandler<Base, Args...>, boost::intrusive::cache_last<true>, boost::intrusive::constant_time_size<true> >;

using HandlerList🔗

template <typename... Args>
using batt::HandlerList = typedef BasicHandlerList<DefaultHandlerBase, Args...>;

using ErrorCode🔗

using batt::ErrorCode = typedef boost::system::error_code;

using MCSMutex🔗

using batt::MCSMutex = typedef BasicMCSMutex<false>;

using RateLimiter🔗

using batt::RateLimiter = typedef BasicRateLimiter<std::chrono::steady_clock>;

using ReadWriteLock🔗

using batt::ReadWriteLock = typedef BasicReadWriteLock<WatchAtomic>;

using ScopedReadLock🔗

template <typename T >
using batt::ScopedReadLock = typedef ScopedReadWriteLockImpl<const T, ReadWriteLock::Reader>;

using ScopedWriteLock🔗

template <typename T >
using batt::ScopedWriteLock = typedef ScopedReadWriteLockImpl<T, ReadWriteLock::Writer>;

using SimpleExecutor🔗

using batt::SimpleExecutor = typedef BasicExecutor<SimpleExecutionContext, boost::asio::execution::outstanding_work_t::untracked_t, boost::asio::execution::blocking_t::never_t, boost::asio::execution::relationship_t::fork_t>;

using TaskCount🔗

using batt::TaskCount = typedef ::batt::StrongType< usize , TaskCount_TAG >;

using InputSize🔗

using batt::InputSize = typedef ::batt::StrongType< usize , InputSize_TAG >;

using TaskSize🔗

using batt::TaskSize = typedef ::batt::StrongType< usize , TaskSize_TAG >;

using TaskIndex🔗

using batt::TaskIndex = typedef ::batt::StrongType< usize , TaskIndex_TAG >;

using TaskOffset🔗

using batt::TaskOffset = typedef ::batt::StrongType< isize , TaskOffset_TAG >;

using ConstBuffer🔗

using batt::ConstBuffer = typedef boost::asio::const_buffer;

using MutableBuffer🔗

using batt::MutableBuffer = typedef boost::asio::mutable_buffer;

using HttpClientConnection🔗

using batt::HttpClientConnection = typedef BasicHttpClientConnection<TcpTransport>;

using HttpsClientConnection🔗

using batt::HttpsClientConnection = typedef BasicHttpClientConnection<SslTransport>;

using IncludeHttpTrailer🔗

using batt::IncludeHttpTrailer = typedef ::batt::StrongType< bool , IncludeHttpTrailer_TAG >;

using HttpHeader🔗

using batt::HttpHeader = typedef ::pico_http::MessageHeader;

using HttpRequestDispatcherFn🔗

using batt::HttpRequestDispatcherFn = typedef SmallFn<Status(HttpRequest& request, HttpResponse& response)>;

One request dispatcher is created per accepted connection; it is reused in the context of that connection until the connection is closed.

using HttpRequestDispatcherFactoryFn🔗

using batt::HttpRequestDispatcherFactoryFn = typedef SmallFn<StatusOr<HttpRequestDispatcherFn>()>;

Called once per accepted connection.

using Interval🔗

template <typename T >
using batt::Interval = typedef BasicInterval<IClosedOpen<T> >;

A half-open interval (like STL iterator ranges).

For this type of interval, lower_bound is the smallest value in the set, and upper_bound is the value right after the largest value in the set.

Example:

#include <batteries/assert.hpp>
#include <batteries/interval.hpp>

int main()
{
    batt::Interval<int> i{3, 7};

    BATT_CHECK_EQ(i.size(), 4);
    BATT_CHECK(i.contains(3));
    BATT_CHECK(i.contains(6));
    BATT_CHECK(!i.contains(2));
    BATT_CHECK(!i.contains(7));
    BATT_CHECK((batt::Interval<int>{5, 5}).empty());

    return 0;
}

Filename: examples/interval.cpp

\

using CInterval🔗

template <typename T >
using batt::CInterval = typedef BasicInterval<IClosed<T> >;

A closed interval.

For this type of interval, lower_bound is the smallest value in the set, and upper_bound is the largest value in the set.

Example:

using DerivedMetric🔗

template <typename T >
using batt::DerivedMetric = typedef std::function<T()>;

using MetricLabelSet🔗

using batt::MetricLabelSet = typedef std::vector<MetricLabel>;

using CountMetricExporter🔗

template <typename T >
using batt::CountMetricExporter = typedef ScalarMetricExporter<CountMetric<T> >;

Exports a CountMetric.

using GaugeMetricExporter🔗

template <typename T >
using batt::GaugeMetricExporter = typedef ScalarMetricExporter<GaugeMetric<T> >;

Exports a GaugeMetric.

using Nullable🔗

template <typename T >
using batt::Nullable = typedef typename detail::NullableImpl<T>::type;

using UniqueNonOwningPtr🔗

template <typename T >
using batt::UniqueNonOwningPtr = typedef std::unique_ptr<T, NoopDeleter>;

using HasSeqRequirements🔗

template <typename T >
using batt::HasSeqRequirements = typedef decltype(detail::has_seq_requirements_impl<T>(nullptr));

using EnableIfSeq🔗

template <typename T >
using batt::EnableIfSeq = typedef std::enable_if_t<has_seq_requirements<T>()>;

using SeqItem🔗

template <typename T >
using batt::SeqItem = typedef typename SeqItem_Impl<T>::type;

using RefCounted🔗

template <typename T >
using batt::RefCounted = typedef boost::intrusive_ref_counter<std::decay_t<T> >;

using IsRefCounted🔗

template <typename T >
using batt::IsRefCounted = typedef decltype(detail::is_ref_counted_impl<std::decay_t<T> >(nullptr));

using SharedPtr🔗

template <typename T >
using batt::SharedPtr = typedef typename SharedPtrImpl<T>::type;

using Slice🔗

template <typename T >
using batt::Slice = typedef boost::iterator_range<T*>;

using UniqueSmallFn🔗

1
2
3
4
template <typename Signature ,
usize kMaxSize =kCpuCacheLineSize - sizeof(void*),
bool kAllowAlloc =false>
using batt::UniqueSmallFn = typedef SmallFn<Signature, kMaxSize, true, kAllowAlloc>;

A type-erased container for a move-only callable function-like object.

This type can be used to hold copyable functions, but is itself move-only, therefore does not require copy semantics from erased types.

using SmallVec🔗

1
2
3
template <typename T ,
usize kStaticSize =kDefaultSmallVecSize>
using batt::SmallVec = typedef boost::container::small_vector<T, kStaticSize>;

using SmallVecBase🔗

template <typename T >
using batt::SmallVecBase = typedef boost::container::small_vector_base<T>;

using PrintToStreamFunctionPointer🔗

using batt::PrintToStreamFunctionPointer = typedef void (*)(std::ostream&);

using StateMachineEntropySource🔗

using batt::StateMachineEntropySource = typedef BasicStateMachineEntropySource<std::function<usize(usize min_value, usize max_value)> >;

using IsStatusOr🔗

template <typename T >
using batt::IsStatusOr = typedef detail::IsStatusOrImpl<std::decay_t<T> >;

using RemoveStatusOr🔗

template <typename T >
using batt::RemoveStatusOr = typedef typename RemoveStatusOrImpl<std::decay_t<T> >::type;

using Token🔗

using batt::Token = typedef boost::flyweights::flyweight<std::string, boost::flyweights::no_tracking>;

using MorphTuple_t🔗

1
2
3
template <template< typename... > class TemplateT,
typename TupleT >
using batt::MorphTuple_t = typedef typename MorphTuple<TemplateT, std::decay_t<TupleT> >::type;

using MapTuple_t🔗

1
2
3
template <template< typename > class PerTypeT,
typename TupleT >
using batt::MapTuple_t = typedef typename MapTuple<PerTypeT, std::decay_t<TupleT> >::type;

using IsCallable🔗

1
2
3
template <typename Fn ,
typename... Args>
using batt::IsCallable = typedef decltype(detail::is_callable_impl<Fn, Args...>(nullptr));

using IsPrintable🔗

template <typename T >
using batt::IsPrintable = typedef decltype(detail::is_printable_impl<T>(nullptr));

using IsRange🔗

template <typename T >
using batt::IsRange = typedef decltype(detail::is_range_impl<T>(nullptr));

using EnableIfNoShadow🔗

1
2
3
template <typename T ,
typename... Args>
using batt::EnableIfNoShadow = typedef std::enable_if_t<!std::is_same<std::tuple<std::decay_t<T>*>, std::tuple<std::decay_t<Args>*...> >{} && !std::is_same<std::tuple<>, std::tuple<std::decay_t<Args>*...> >{} >;

using DecayRValueRef🔗

template <typename T >
using batt::DecayRValueRef = typedef typename DecayRValueRefImpl<T>::type;

using CanBeEqCompared🔗

1
2
3
template <typename T ,
typename U  =T>
using batt::CanBeEqCompared = typedef decltype(detail::can_be_eq_compared_helper<T, U>(nullptr, nullptr));

using UnwrapRefType🔗

template <typename T >
using batt::UnwrapRefType = typedef decltype(unwrap_ref(std::declval<T>()));

Functions Documentation🔗

function parallel_accumulate_partial🔗

template <typename Iter ,
typename T ,
typename BinaryOp >
Slice< T > parallel_accumulate_partial(
    WorkContext & context,
    Iter first,
    Iter last,
    T init,
    const BinaryOp & binary_op,
    T identity,
    const Slice< T > & task_result_buffer,
    const WorkSliceParams & params
)

function parallel_accumulate🔗

template <typename Iter ,
typename T ,
typename BinaryOp >
T parallel_accumulate(
    WorkerPool & worker_pool,
    Iter first,
    Iter last,
    T init,
    const BinaryOp & binary_op,
    T identity,
    TaskSize min_task_size =TaskSize{4096},
    TaskCount max_tasks =TaskCount{std::thread::hardware_concurrency()}
)

function parallel_copy🔗

template <typename Src ,
typename Dst >
void parallel_copy(
    WorkContext & work_context,
    Src src_begin,
    Src src_end,
    Dst dst_begin,
    TaskSize min_task_size,
    TaskCount max_tasks
)

function parallel_merge🔗

template <typename Src0 ,
typename Src1 ,
typename Dst ,
typename Compare >
void parallel_merge(
    WorkerPool & worker_pool,
    Src0 src_0_begin,
    Src0 src_0_end,
    Src1 src_1_begin,
    Src1 src_1_end,
    Dst dst_begin,
    Compare && compare,
    usize min_task_size =1400,
    usize max_tasks =std::thread::hardware_concurrency()/2
)

function parallel_merge🔗

template <typename Src0 ,
typename Src1 ,
typename Dst ,
typename Compare >
void parallel_merge(
    WorkContext & context,
    Src0 src_0_begin,
    Src0 src_0_end,
    Src1 src_1_begin,
    Src1 src_1_end,
    Dst dst_begin,
    Compare && compare,
    usize min_task_size =1400,
    usize max_tasks =std::thread::hardware_concurrency()/2
)

function parallel_running_total🔗

template <typename Iter ,
typename Fn ,
typename ValueT  =std::decay_t<std::invoke_result_t<Fn, typename std::iterator_traits<Iter>::reference>>>
BasicRunningTotal< ValueT > parallel_running_total(
    WorkerPool & worker_pool,
    Iter first,
    Iter last,
    const Fn & fn,
    const WorkSliceParams & params
)

function parallel_running_total🔗

1
2
3
4
5
6
7
8
template <typename Iter ,
typename ValueT  =typename std::iterator_traits<Iter>::value_type>
BasicRunningTotal< ValueT > parallel_running_total(
    WorkerPool & worker_pool,
    Iter first,
    Iter last,
    const WorkSliceParams & params
)

function parallel_transform🔗

template <typename Src ,
typename Dst ,
typename TransformFn >
void parallel_transform(
    WorkContext & work_context,
    Src src_begin,
    Src src_end,
    Dst dst_begin,
    const TransformFn & transform_fn,
    TaskSize min_task_size,
    TaskCount max_tasks
)

function strong_typedef_default_value🔗

1
2
3
inline constexpr usize strong_typedef_default_value(
    PartsCount_TAG * 
)

function strong_typedef_default_value🔗

1
2
3
inline constexpr usize strong_typedef_default_value(
    PartSize_TAG * 
)

function fail_check_exit🔗

inline void fail_check_exit()

function fail_check_exit_entered🔗

inline std::atomic< bool > & fail_check_exit_entered()

function fail_check_spin_lock🔗

inline std::atomic< bool > & fail_check_spin_lock()

function ignore🔗

1
2
3
4
template <typename... Ts>
inline bool ignore(
    Ts && ...
)

function lock_fail_check_mutex🔗

inline bool lock_fail_check_mutex()

function async_run_task🔗

1
2
3
4
5
6
7
8
template <typename BodyFn  =void(),
typename... TaskArgsAndHandler>
Task * async_run_task(
    const boost::asio::any_io_executor & ex,
    StackSize stack_byte_size,
    BodyFn && body_fn,
    TaskArgsAndHandler &&... task_args_and_handler
)

Creates and starts (default) a new batt::Task, the memory for which (including stack) is allocated as a single contiguous memory region using the allocated associated with the final arg passed to this function, the completion handler.

The completion handler will automatically be called when the task completes; the memory associated with the task will also be automatically freed before (a copy of) the completion handler is invoked. The completion handler signature is void().

function with_retry_policy🔗

template <typename RetryPolicy ,
typename ActionFn ,
typename Result  =std::invoke_result_t<ActionFn>,
typename SleepImpl  =TaskSleepImpl,
typename StatusIsRetryableImpl  =DefaultStatusIsRetryableImpl>
Result with_retry_policy(
    RetryPolicy && policy,
    std::string_view action_name,
    ActionFn && action_fn,
    SleepImpl && sleep_impl ={},
    StatusIsRetryableImpl && status_is_retryable_impl ={}
)

function update_retry_state🔗

1
2
3
4
inline void update_retry_state(
    RetryState & state,
    const ExponentialBackoff & policy
)

function has_const_buffer_sequence_requirements🔗

1
2
3
4
template <typename T >
inline constexpr bool has_const_buffer_sequence_requirements(
    StaticType< T >  ={}
)

function has_buffer_source_requirements🔗

1
2
3
4
template <typename T >
inline constexpr bool has_buffer_source_requirements(
    StaticType< T >  ={}
)

function operator|🔗

1
2
3
4
5
6
template <typename Src ,
typename  =EnableIfBufferSource<Src>>
TakeNSource< Src > operator|(
    Src && src,
    seq::TakeNBinder binder
)

function operator|🔗

1
2
3
4
5
6
template <typename Src ,
typename  =EnableIfBufferSource<Src>>
void operator|(
    Src && ,
    SkipNBinder 
)

function operator|🔗

1
2
3
4
5
6
7
template <typename Src ,
typename Fn ,
typename  =EnableIfBufferSource<Src>>
inline StatusOr< seq::LoopControl > operator|(
    Src && src,
    seq::ForEachBinder< Fn > && binder
)

function operator|🔗

1
2
3
4
5
6
template <typename Src ,
typename  =EnableIfBufferSource<Src>>
inline StatusOr< std::vector< char > > operator|(
    Src && src,
    seq::CollectVec 
)

function operator|🔗

1
2
3
4
5
6
template <typename Src ,
typename  =EnableIfBufferSource<Src>>
inline Status operator|(
    Src && src,
    seq::PrintOut p
)

function operator|🔗

1
2
3
4
5
6
template <typename Src ,
typename  =EnableIfBufferSource<Src>>
inline Status operator|(
    Src && src,
    seq::Consume 
)

function operator|🔗

1
2
3
4
5
6
7
template <typename Src ,
typename AsyncWriteStream ,
typename  =EnableIfBufferSource<Src>>
StatusOr< usize > operator|(
    Src && src,
    seq::WriteToBinder< AsyncWriteStream > && binder
)

function operator|🔗

1
2
3
4
5
6
7
8
template <typename Src ,
typename ConstBufferSequence ,
typename  =EnableIfBufferSource<Src>,
typename  =EnableIfConstBufferSequence<ConstBufferSequence>>
inline auto operator|(
    Src && src,
    seq::PrependBinder< ConstBufferSequence > && binder
)

function hash_value🔗

1
2
3
inline usize hash_value(
    const CancelToken & cancel_token
)

CancelToken is hashed by its impl pointer.

function operator==🔗

1
2
3
4
inline bool operator==(
    const CancelToken & l,
    const CancelToken & r
)

Returns true iff the two objects are copies of the same CancelToken.

function operator!=🔗

1
2
3
4
inline bool operator!=(
    const CancelToken & l,
    const CancelToken & r
)

function operator<🔗

1
2
3
4
inline bool operator<(
    const CancelToken & l,
    const CancelToken & r
)

function operator>🔗

1
2
3
4
inline bool operator>(
    const CancelToken & l,
    const CancelToken & r
)

function operator<=🔗

1
2
3
4
inline bool operator<=(
    const CancelToken & l,
    const CancelToken & r
)

function operator>=🔗

1
2
3
4
inline bool operator>=(
    const CancelToken & l,
    const CancelToken & r
)

function is_cancelled🔗

1
2
3
4
template <typename T >
inline bool is_cancelled(
    const CancelToken::HandlerImpl< T > & handler
)

function is_cancelled🔗

1
2
3
4
template <typename T >
inline bool is_cancelled(
    const CustomAllocHandler< CancelToken::HandlerImpl< T >> & handler
)

function BOOST_PP_CAT🔗

1
2
3
4
static BATT_MAYBE_UNUSED ::batt::StaticBinaryAssertion< decltype(sizeof(void *) *2), decltype(sizeof(boost::context::stack_context)),(sizeof(void *) *2), ::batt::Eq,(sizeof(boost::context::stack_context)),((sizeof(void *) *2)==(sizeof(boost::context::stack_context)))> BOOST_PP_CAT(
    BOOST_PP_CAT(BATTERIES_StaticAssert_Instance_, __LINE__) ,
    __COUNTER__ 
)

function strong_typedef_default_value🔗

1
2
3
inline constexpr usize strong_typedef_default_value(
    StackSize_TAG * 
)

function get_stack_allocator_with_type🔗

1
2
3
4
template <typename T >
inline const StackAllocator & get_stack_allocator_with_type(
    StackSize stack_size
)

function get_stack_allocator🔗

1
2
3
4
inline const StackAllocator & get_stack_allocator(
    StackSize stack_size,
    StackType stack_type
)

function callcc🔗

1
2
3
4
5
template <typename Fn >
inline Continuation callcc(
    StackAllocator && stack_allocator,
    Fn && fn
)

function callcc🔗

1
2
3
4
5
6
template <typename Fn >
inline Continuation callcc(
    StackSize stack_size,
    StackType stack_type,
    Fn && fn
)

function this_task_debug_info🔗

1
2
3
inline void this_task_debug_info(
    std::ostream & out
)

function print_debug_info🔗

1
2
3
4
inline void print_debug_info(
    DebugInfoFrame * p,
    std::ostream & out
)

function print_all_threads_debug_info🔗

1
2
3
inline void print_all_threads_debug_info(
    std::ostream & out
)

function shortened_source_file🔗

1
2
3
inline const char * shortened_source_file(
    const char * raw
)

function enable_dump_tasks🔗

inline bool enable_dump_tasks()

function operator==🔗

1
2
3
4
5
template <typename OutstandingWorkP >
constexpr bool operator==(
    const BasicFakeExecutor< OutstandingWorkP > & l,
    const BasicFakeExecutor< OutstandingWorkP > & r
)

function operator!=🔗

1
2
3
4
5
template <typename OutstandingWorkP >
constexpr bool operator!=(
    const BasicFakeExecutor< OutstandingWorkP > & l,
    const BasicFakeExecutor< OutstandingWorkP > & r
)

function operator<🔗

1
2
3
4
inline bool operator<(
    const FakeTimeService::TimerInstance & l,
    const FakeTimeService::TimerInstance & r
)

function operator>🔗

1
2
3
4
inline bool operator>(
    const FakeTimeService::TimerInstance & l,
    const FakeTimeService::TimerInstance & r
)

function operator<=🔗

1
2
3
4
inline bool operator<=(
    const FakeTimeService::TimerInstance & l,
    const FakeTimeService::TimerInstance & r
)

function operator>=🔗

1
2
3
4
inline bool operator>=(
    const FakeTimeService::TimerInstance & l,
    const FakeTimeService::TimerInstance & r
)

function fetch_chunk🔗

1
2
3
4
5
6
7
template <typename AsyncFetchStreamT ,
typename ScopedChunk  =BasicScopedChunk<AsyncFetchStreamT>,
typename ConstBufferSequence  =typename AsyncFetchStreamT::const_buffers_type>
batt::StatusOr< ScopedChunk > fetch_chunk(
    AsyncFetchStreamT & stream,
    usize min_size
)

Awaits the result of an async_fetch on the passed stream with the given minimum chunk size.

The returned chunk object will cause the fetched data to be consumed from the stream by default when it goes out of scope. Some of the fetched data can be left in the stream by calling BasicScopedChunk::back_up.

This function blocks the current task until min_size bytes are available on the stream, or an error occurs (e.g., end-of-stream).

function transfer_chunked_data🔗

1
2
3
4
5
6
7
template <typename From ,
typename To >
inline StatusOr< usize > transfer_chunked_data(
    From & from,
    To & to,
    TransferStep & step
)

function transfer_chunked_data🔗

1
2
3
4
5
6
template <typename From ,
typename To >
inline StatusOr< usize > transfer_chunked_data(
    From & from,
    To & to
)

Fetches data from the first arg and writes it to the second arg, until an error or end-of-file/stream occurs.

Return: The number of bytes transferred if successful, error Status otherwise

In this overload, From should have a public member function fetch_chunk which returns batt::StatusOr. To should have a public member function write which takes a boost::asio::const_buffer (batt::ConstBuffer) and returns batt::StatusOr, indicating the number of bytes actually written to the destination stream.

function futex_wait🔗

1
2
3
4
inline int futex_wait(
    std::atomic< u32 > * ,
    u32 
)

function futex_notify🔗

1
2
3
4
inline int futex_notify(
    std::atomic< u32 > * ,
    u32  =1
)

function spin_yield🔗

inline void spin_yield()

function get_future🔗

1
2
3
4
template <typename T >
Future< T > get_future(
    const Promise< T > & promise
)

Returns the Future object corresponding to the Promise.

function BOOST_PP_CAT🔗

1
2
3
4
static BATT_MAYBE_UNUSED ::batt::StaticBinaryAssertion< decltype(sizeof(UniqueHandler<>)), decltype(sizeof(void *)),(sizeof(UniqueHandler<>)), ::batt::Eq,(sizeof(void *)),((sizeof(UniqueHandler<>))==(sizeof(void *)))> BOOST_PP_CAT(
    BOOST_PP_CAT(BATTERIES_StaticAssert_Instance_, __LINE__) ,
    __COUNTER__ 
)

function push_handler_prealloc🔗

1
2
3
4
5
6
template <typename Base ,
typename... Args>
inline void push_handler_prealloc(
    boost::intrusive::slist< BasicAbstractHandler< Base, Args... >, boost::intrusive::cache_last< true >, boost::intrusive::constant_time_size< true >> * list,
    BasicAbstractHandler< Base, Args... > * handler
)

function push_handler🔗

1
2
3
4
5
6
7
template <typename... Args,
typename Base ,
typename HandlerFn >
inline void push_handler(
    boost::intrusive::slist< BasicAbstractHandler< Base, Args... >, boost::intrusive::cache_last< true >, boost::intrusive::constant_time_size< true >> * list,
    HandlerFn && fn
)

function invoke_all_handlers🔗

1
2
3
4
5
6
7
template <typename... Params,
typename... Args,
typename Base >
inline void invoke_all_handlers(
    boost::intrusive::slist< BasicAbstractHandler< Base, Params... >, boost::intrusive::cache_last< true >, boost::intrusive::constant_time_size< true >> * handlers,
    Args &&... args
)

function bind_handler🔗

1
2
3
4
5
6
template <typename InnerFn ,
typename OuterFn >
HandlerBinder< std::decay_t< InnerFn >, std::decay_t< OuterFn > > bind_handler(
    InnerFn && inner,
    OuterFn && outer
)

function operator==🔗

1
2
3
4
5
6
template <typename T ,
typename U >
bool operator==(
    const HandlerAllocator< T > & left,
    const HandlerAllocator< U > & right
)

function operator!=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
bool operator!=(
    const HandlerAllocator< T > & left,
    const HandlerAllocator< U > & right
)

function make_custom_alloc_handler🔗

1
2
3
4
5
template <typename Handler >
inline CustomAllocHandler< std::decay_t< Handler > > make_custom_alloc_handler(
    HandlerMemoryBase & m,
    Handler && h
)

Helper function to wrap a handler object to add custom allocation.

function post_handler🔗

1
2
3
4
5
6
template <typename Handler ,
typename... Args>
void post_handler(
    Handler && handler,
    Args &&... args
)

Posts a handler using its associated executor, binding its arguments.

function operator<<🔗

1
2
3
4
5
template <typename... Ts>
inline std::ostream & operator<<(
    std::ostream & out,
    const IOResult< Ts... > & t
)

function is_ok_status🔗

1
2
3
4
template <typename... Ts>
bool is_ok_status(
    const IOResult< Ts... > & io_result
)

function is_ok_status🔗

1
2
3
inline bool is_ok_status(
    const ErrorCode & ec
)

function to_status🔗

1
2
3
4
template <typename... Ts>
Status to_status(
    const IOResult< Ts... > & io_result
)

function pin_object🔗

1
2
3
4
template <typename T >
void pin_object(
    T * object
)

function unpin_object🔗

1
2
3
4
template <typename T >
void unpin_object(
    T * object
)

function make_pin🔗

1
2
3
4
template <typename T >
inline Pin< T > make_pin(
    T * object
)

function operator==🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator==(
    const Pin< T > & l,
    const Pin< U > & r
)

function operator!=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator!=(
    const Pin< T > & l,
    const Pin< U > & r
)

function operator==🔗

1
2
3
4
5
template <typename T >
inline bool operator==(
    const Pin< T > & l,
    std::nullptr_t 
)

function operator!=🔗

1
2
3
4
5
template <typename T >
inline bool operator!=(
    const Pin< T > & l,
    std::nullptr_t 
)

function operator==🔗

1
2
3
4
5
template <typename U >
inline bool operator==(
    std::nullptr_t ,
    const Pin< U > & r
)

function operator!=🔗

1
2
3
4
5
template <typename U >
inline bool operator!=(
    std::nullptr_t ,
    const Pin< U > & r
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const DumpReadWriteLockState & dump
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    ReadWriteLockQueueNodeClass t
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const ScalableGrant & t
)

function strong_typedef_default_value🔗

1
2
3
inline constexpr usize strong_typedef_default_value(
    TaskCount_TAG * 
)

function strong_typedef_default_value🔗

1
2
3
inline constexpr usize strong_typedef_default_value(
    InputSize_TAG * 
)

function strong_typedef_default_value🔗

1
2
3
inline constexpr usize strong_typedef_default_value(
    TaskSize_TAG * 
)

function strong_typedef_default_value🔗

1
2
3
inline constexpr usize strong_typedef_default_value(
    TaskIndex_TAG * 
)

function strong_typedef_default_value🔗

1
2
3
inline constexpr isize strong_typedef_default_value(
    TaskOffset_TAG * 
)

function get_input_size🔗

1
2
3
4
5
template <typename Iter >
inline InputSize get_input_size(
    const Iter & first,
    const Iter & last
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const WorkSliceParams & t
)

function get_task_size🔗

1
2
3
4
inline TaskSize get_task_size(
    const WorkSliceParams & params,
    InputSize input_size
)

function get_task_count🔗

1
2
3
4
inline TaskCount get_task_count(
    InputSize input_size,
    TaskSize task_size
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const WorkSlicePlan & t
)

function slice_work🔗

1
2
3
4
5
6
template <typename WorkFnGenerator >
Status slice_work(
    WorkContext & context,
    const WorkSlicePlan & plan,
    WorkFnGenerator && gen_work_fn
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const SpinGrant & t
)

function operator<<🔗

1
2
3
4
5
template <typename T >
StatusOr< std::reference_wrapper< StreamBuffer > > operator<<(
    StatusOr< std::reference_wrapper< StreamBuffer >> stream_buffer,
    T && obj
)

function next_thread_id🔗

inline i32 next_thread_id()

Returns the lowest unused global thread id number; repeated calls to next_thread_id() will return monotonically increasing values.

function this_thread_id🔗

inline i32 & this_thread_id()

Returns a reference to the thread-local id for the current thread.

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    WaitForResource t
)

function operator<<🔗

1
2
3
4
5
template <typename T >
inline std::ostream & operator<<(
    std::ostream & out,
    const Watch< T > & w
)

Support for printing Watch to ostream.

function operator<<🔗

1
2
3
4
5
template <typename T >
inline std::ostream & operator<<(
    std::ostream & out,
    const WatchAtomic< T > & w
)

Support for printing WatchAtomic to ostream.

function bool_status_from🔗

1
2
3
inline constexpr BoolStatus bool_status_from(
    bool b
)

Constructs a BoolStatus value from a bool.

function operator||🔗

1
2
3
4
inline constexpr BoolStatus operator||(
    BoolStatus left,
    BoolStatus right
)

Performs a logical-or (disjunction) between two BoolStatus values.

If one of the arguments is BoolStatus::kTrue, then the result is BoolStatus::kTrue. If both arguments are BoolStatus::kFalse, then the result is BoolStatus::kFalse. Otherwise, at least one argument is BoolStatus::kUnknown, and the result is BoolStatus::kUnknown.

function operator&&🔗

1
2
3
4
inline constexpr BoolStatus operator&&(
    BoolStatus left,
    BoolStatus right
)

Performs a logical-and (conjunction) between two BoolStatus values.

If one of the arguments is BoolStatus::kFalse, then the result is BoolStatus::kFalse. If both arguments are BoolStatus::kTrue, then the result is BoolStatus::kTrue. Otherwise, at least one argument is BoolStatus::kUnknown, and the result is BoolStatus::kUnknown.

function operator!🔗

1
2
3
inline constexpr BoolStatus operator!(
    BoolStatus b
)

Performs a logical-not (negation) for the given BoolStatus value.

If b is kUnknown, then the result is also kUnknown. Otherwise kFalse becomes kTrue and vice versa.

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const BoolStatus & t
)

Prints a BoolStatus value.

function least_upper_bound🔗

1
2
3
inline i8 least_upper_bound(
    i8 n
)

function greatest_lower_bound🔗

1
2
3
inline i8 greatest_lower_bound(
    i8 n
)

function least_upper_bound🔗

1
2
3
inline i16 least_upper_bound(
    i16 n
)

function greatest_lower_bound🔗

1
2
3
inline i16 greatest_lower_bound(
    i16 n
)

function least_upper_bound🔗

1
2
3
inline i32 least_upper_bound(
    i32 n
)

function greatest_lower_bound🔗

1
2
3
inline i32 greatest_lower_bound(
    i32 n
)

function least_upper_bound🔗

1
2
3
inline i64 least_upper_bound(
    i64 n
)

function greatest_lower_bound🔗

1
2
3
inline i64 greatest_lower_bound(
    i64 n
)

function least_upper_bound🔗

1
2
3
inline u8 least_upper_bound(
    u8 n
)

function greatest_lower_bound🔗

1
2
3
inline u8 greatest_lower_bound(
    u8 n
)

function least_upper_bound🔗

1
2
3
inline u16 least_upper_bound(
    u16 n
)

function greatest_lower_bound🔗

1
2
3
inline u16 greatest_lower_bound(
    u16 n
)

function least_upper_bound🔗

1
2
3
inline u32 least_upper_bound(
    u32 n
)

function greatest_lower_bound🔗

1
2
3
inline u32 greatest_lower_bound(
    u32 n
)

function least_upper_bound🔗

1
2
3
inline u64 least_upper_bound(
    u64 n
)

function greatest_lower_bound🔗

1
2
3
inline u64 greatest_lower_bound(
    u64 n
)

function least_upper_bound🔗

1
2
3
4
template <typename T >
LeastUpperBound< std::decay_t< T > > least_upper_bound(
    T && value
)

function operator<🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<(
    const T & left,
    const LeastUpperBound< U > & right
)

function operator<🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<(
    const LeastUpperBound< T > & left,
    const U & right
)

function operator<🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<(
    const LeastUpperBound< T > & left,
    const LeastUpperBound< U > & right
)

function operator==🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator==(
    const T & ,
    const LeastUpperBound< U > & 
)

function operator==🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator==(
    const LeastUpperBound< T > & ,
    const U & 
)

function operator==🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator==(
    const LeastUpperBound< T > & left,
    const LeastUpperBound< U > & right
)

function operator>🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>(
    const T & l,
    const LeastUpperBound< U > & r
)

function operator<=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<=(
    const T & l,
    const LeastUpperBound< U > & r
)

function operator>=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>=(
    const T & l,
    const LeastUpperBound< U > & r
)

function operator>🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>(
    const LeastUpperBound< T > & l,
    const U & r
)

function operator<=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<=(
    const LeastUpperBound< T > & l,
    const U & r
)

function operator>=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>=(
    const LeastUpperBound< T > & l,
    const U & r
)

function operator>🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>(
    const LeastUpperBound< T > & l,
    const LeastUpperBound< U > & r
)

function operator<=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<=(
    const LeastUpperBound< T > & l,
    const LeastUpperBound< U > & r
)

function operator>=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>=(
    const LeastUpperBound< T > & l,
    const LeastUpperBound< U > & r
)

function operator!=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator!=(
    const T & l,
    const LeastUpperBound< U > & r
)

function operator!=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator!=(
    const LeastUpperBound< T > & l,
    const U & r
)

function operator!=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator!=(
    const LeastUpperBound< T > & l,
    const LeastUpperBound< U > & r
)

function greatest_lower_bound🔗

1
2
3
4
5
template <typename T ,
typename U >
GreatestLowerBound< std::decay_t< T > > greatest_lower_bound(
    T && value
)

function operator<🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<(
    const T & left,
    const GreatestLowerBound< U > & right
)

function operator<🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<(
    const GreatestLowerBound< T > & left,
    const U & right
)

function operator<🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<(
    const GreatestLowerBound< T > & left,
    const GreatestLowerBound< U > & right
)

function operator==🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator==(
    const T & ,
    const GreatestLowerBound< U > & 
)

function operator==🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator==(
    const GreatestLowerBound< T > & ,
    const U & 
)

function operator==🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator==(
    const GreatestLowerBound< T > & left,
    const GreatestLowerBound< U > & right
)

function operator>🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>(
    const T & l,
    const GreatestLowerBound< U > & r
)

function operator<=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<=(
    const T & l,
    const GreatestLowerBound< U > & r
)

function operator>=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>=(
    const T & l,
    const GreatestLowerBound< U > & r
)

function operator>🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>(
    const GreatestLowerBound< T > & l,
    const U & r
)

function operator<=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<=(
    const GreatestLowerBound< T > & l,
    const U & r
)

function operator>=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>=(
    const GreatestLowerBound< T > & l,
    const U & r
)

function operator>🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>(
    const GreatestLowerBound< T > & l,
    const GreatestLowerBound< U > & r
)

function operator<=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator<=(
    const GreatestLowerBound< T > & l,
    const GreatestLowerBound< U > & r
)

function operator>=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator>=(
    const GreatestLowerBound< T > & l,
    const GreatestLowerBound< U > & r
)

function operator!=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator!=(
    const T & l,
    const GreatestLowerBound< U > & r
)

function operator!=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator!=(
    const GreatestLowerBound< T > & l,
    const U & r
)

function operator!=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator!=(
    const GreatestLowerBound< T > & l,
    const GreatestLowerBound< U > & r
)

function make_buffer🔗

1
2
3
4
template <typename... Args>
decltype(auto) make_buffer(
    Args &&... args
)

function buffer_from_struct🔗

1
2
3
4
template <typename T >
inline ConstBuffer buffer_from_struct(
    const T & val
)

function as_str🔗

1
2
3
inline std::string_view as_str(
    const ConstBuffer & buffer
)

Converts a ConstBuffer into an equivalent std::string_view.

function bytes_from_struct🔗

1
2
3
4
template <typename T >
inline std::string_view bytes_from_struct(
    const T & val
)

Returns a std::string_view with the same size and data address as the passed object, as if the address of val had been reinterpret_cast to type const char*.

Should only be used for types used to define serialized data layouts.

function mutable_buffer_from_struct🔗

1
2
3
4
template <typename T >
inline MutableBuffer mutable_buffer_from_struct(
    T & val
)

function resize_buffer🔗

1
2
3
4
inline ConstBuffer resize_buffer(
    const ConstBuffer & b,
    usize s
)

function resize_buffer🔗

1
2
3
4
inline MutableBuffer resize_buffer(
    const MutableBuffer & b,
    usize s
)

function slice_buffer🔗

1
2
3
4
5
template <typename SizeT >
inline ConstBuffer slice_buffer(
    const ConstBuffer & b,
    const Interval< SizeT > & slice
)

Select a subset of the passed buffer according to the passed interval.

Parameters:

  • b The buffer to slice
  • slice Defines the start (inclusive) and end (non-inclusive) of the slice within buffer

function slice_buffer🔗

1
2
3
4
5
template <typename SizeT >
inline MutableBuffer slice_buffer(
    const MutableBuffer & b,
    const Interval< SizeT > & slice
)

Select a subset of the passed buffer according to the passed interval.

Parameters:

  • b The buffer to slice
  • slice Defines the start (inclusive) and end (non-inclusive) of the slice within buffer

function consume_buffers🔗

1
2
3
4
5
template <typename VecT >
inline void consume_buffers(
    VecT & buffers,
    usize count
)

function consume_buffers_iter🔗

1
2
3
4
5
6
template <typename Iter >
inline std::pair< Iter, usize > consume_buffers_iter(
    const std::pair< Iter, usize > & pos,
    const Iter & last,
    usize count
)

function consume_buffers_copy🔗

1
2
3
4
5
template <typename VecT >
inline VecT consume_buffers_copy(
    const VecT & buffers,
    usize count
)

function array_from_c_str🔗

1
2
3
4
5
6
template <usize kLength,
usize... kIndex>
constexpr std::array< char, kLength - 1 > array_from_c_str(
    const char(&) c_str[kLength],
    std::index_sequence< kIndex... > 
)

Converts a compile-time string constant to std::array, automatically inferring the string length (without the null-terminator).

function array_from_c_str🔗

1
2
3
4
template <usize kLength>
constexpr std::array< char, kLength - 1 > array_from_c_str(
    const char(&) c_str[kLength]
)

Converts a compile-time string constant to std::array, automatically inferring the string length (without the null-terminator).

function as_const_buffer🔗

1
2
3
inline ConstBuffer as_const_buffer(
    const ConstBuffer & buffer
)

function as_const_buffer🔗

1
2
3
inline ConstBuffer as_const_buffer(
    const MutableBuffer & buffer
)

function as_const_buffer🔗

1
2
3
inline ConstBuffer as_const_buffer(
    const std::string_view & str
)

function as_const_buffer🔗

1
2
3
inline ConstBuffer as_const_buffer(
    const std::string & str
)

function as_const_buffer🔗

1
2
3
4
template <usize kSize>
inline ConstBuffer as_const_buffer(
    const std::array< char, kSize > & arr
)

function as_const_buffer🔗

1
2
3
4
template <usize kSize>
inline ConstBuffer as_const_buffer(
    const std::array< u8, kSize > & arr
)

function as_const_buffer🔗

1
2
3
inline ConstBuffer as_const_buffer(
    const std::vector< char > & vec
)

function as_const_buffer🔗

1
2
3
inline ConstBuffer as_const_buffer(
    const std::vector< u8 > & vec
)

function as_const_buffer🔗

1
2
3
inline ConstBuffer as_const_buffer(
    const SmallVecBase< char > & vec
)

function as_const_buffer🔗

1
2
3
inline ConstBuffer as_const_buffer(
    const SmallVecBase< u8 > & vec
)

function as_const_buffer🔗

1
2
3
4
template <usize kLength>
inline ConstBuffer as_const_buffer(
    const char(&) c_str[kLength]
)

function make_case_of_visitor🔗

1
2
3
4
template <typename... Cases>
CaseOfVisitor< Cases &&... > make_case_of_visitor(
    Cases &&... cases
)

Constructs and returns a single overloaded callable function object that forwards its arguments on to the first object in cases that is callable with those arguments.

function case_of🔗

1
2
3
4
5
6
template <typename VarType ,
typename... Cases>
decltype(auto) case_of(
    VarType && v,
    Cases &&... cases
)

Matches a variant against a list of callables and apply the first one that will accept the current value.

Example: ```cpp

std::variant var = Bar{};

int result = batt::case_of( var, { return 1; }, { return 2; });

BATT_CHECK_EQ(result, 2);

1
2
3
4
5
6
7
8
### function is_case

```cpp
template <typename T ,
typename Var >
bool is_case(
    Var && v
)

function checked_cast🔗

1
2
3
4
5
6
7
8
template <typename ToType ,
typename FromType ,
typename  =std::enable_if_t<std::is_signed_v<ToType> == std::is_signed_v<FromType>>>
ToType checked_cast(
    FromType val,
    const char * file ="",
    int line =0
)

function checked_cast🔗

1
2
3
4
5
6
7
8
9
template <typename ToType ,
typename FromType ,
typename  =std::enable_if_t<std::is_signed_v<ToType> && !std::is_signed_v<FromType>>,
typename  =void>
ToType checked_cast(
    FromType val,
    const char * file ="",
    int line =0
)

function checked_cast🔗

template <typename ToType ,
typename FromType ,
typename  =std::enable_if_t<!std::is_signed_v<ToType> && std::is_signed_v<FromType>>,
typename  =void,
typename  =void>
ToType checked_cast(
    FromType val,
    const char * file ="",
    int line =0
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    Order t
)

function compare🔗

1
2
3
4
inline Order compare(
    const std::string_view & a,
    const std::string_view & b
)

function operator<<🔗

1
2
3
4
5
template <typename T >
inline std::ostream & operator<<(
    std::ostream & out,
    const CpuCacheLineIsolated< T > & t
)

function pin_thread_to_cpu🔗

1
2
3
inline Status pin_thread_to_cpu(
    usize cpu_i
)

function pin_thread_to_cpu_set🔗

1
2
3
4
template <typename IntRange >
inline Status pin_thread_to_cpu_set(
    const IntRange & cpu_i_set
)

function pin_thread_i_of_config🔗

1
2
3
4
5
inline Status pin_thread_i_of_config(
    usize i,
    const ThreadPoolConfig & config,
    const std::string_view & pool_name =""
)

function do_nothing🔗

1
2
3
4
template <typename... Args>
constexpr void do_nothing(
    Args && ...
)

function big_endian_less_than🔗

1
2
3
4
inline bool big_endian_less_than(
    BOOST_PP_CAT(u, 16) a,
    BOOST_PP_CAT(u, 16) b
)

function big_endian_less_than🔗

1
2
3
4
inline bool big_endian_less_than(
    BOOST_PP_CAT(u, 32) a,
    BOOST_PP_CAT(u, 32) b
)

function big_endian_less_than🔗

1
2
3
4
inline bool big_endian_less_than(
    BOOST_PP_CAT(u, 64) a,
    BOOST_PP_CAT(u, 64) b
)

function getenv_as🔗

1
2
3
4
template <typename T >
Optional< T > getenv_as(
    const char * var_name
)

Parse environment variable as a given type T.

Parameters:

  • var_name The environment variable name

Return: The parsed value if var_name is found and it parses correctly, else batt::None.

function finally🔗

1
2
3
4
template <typename Fn >
auto finally(
    Fn && fn
)

function hash🔗

inline usize hash()

function hash🔗

1
2
3
4
template <typename T >
usize hash(
    T && obj
)

function hash_value🔗

1
2
3
4
5
template <typename T ,
typename HashT  =typename std::decay_t<T>::Hash>
usize hash_value(
    T && obj
)

function hash🔗

1
2
3
4
5
6
template <typename First ,
typename... Rest>
usize hash(
    First && first,
    Rest &&... rest
)

function await_resolve🔗

1
2
3
4
inline StatusOr< SmallVec< boost::asio::ip::tcp::endpoint > > await_resolve(
    boost::asio::ip::tcp::resolver & resolver,
    const HostAddress & host_address
)

function await_resolve🔗

1
2
3
4
inline StatusOr< SmallVec< boost::asio::ip::tcp::endpoint > > await_resolve(
    boost::asio::io_context & io,
    const HostAddress & host_address
)

function hash_value🔗

1
2
3
inline usize hash_value(
    const HostAddress & host_key
)

function operator==🔗

1
2
3
4
inline bool operator==(
    const HostAddress & l,
    const HostAddress & r
)

function operator!=🔗

1
2
3
4
inline bool operator!=(
    const HostAddress & l,
    const HostAddress & r
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const HostAddress & t
)

function http_encode_chunked🔗

1
2
3
4
5
6
7
template <typename Src ,
typename AsyncWriteStream >
inline Status http_encode_chunked(
    Src && src,
    AsyncWriteStream && dst,
    IncludeHttpTrailer include_trailer =IncludeHttpTrailer{false}
)

function http_request🔗

1
2
3
4
5
6
template <typename... Params>
StatusOr< std::unique_ptr< HttpResponse > > http_request(
    std::string_view method,
    std::string_view url,
    Params &&... params
)

Submits an HTTP request, returning the response object.

params must be from the following set:

function http_get🔗

1
2
3
4
5
template <typename... Params>
StatusOr< std::unique_ptr< HttpResponse > > http_get(
    std::string_view url,
    Params &&... params
)

function http_post🔗

1
2
3
4
5
template <typename... Params>
StatusOr< std::unique_ptr< HttpResponse > > http_post(
    std::string_view url,
    Params &&... params
)

function http_put🔗

1
2
3
4
5
template <typename... Params>
StatusOr< std::unique_ptr< HttpResponse > > http_put(
    std::string_view url,
    Params &&... params
)

function http_delete🔗

1
2
3
4
5
template <typename... Params>
StatusOr< std::unique_ptr< HttpResponse > > http_delete(
    std::string_view url,
    Params &&... params
)

function strong_typedef_default_value🔗

1
2
3
inline constexpr bool strong_typedef_default_value(
    IncludeHttpTrailer_TAG * 
)

function find_header🔗

1
2
3
4
inline Optional< std::string_view > find_header(
    const SmallVecBase< HttpHeader > & headers,
    const std::string_view & name
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const HttpMessageInfo & t
)

function push_back🔗

1
2
3
4
5
6
template <typename TraitsT ,
typename DeltaT >
BasicInterval< TraitsT > push_back(
    const BasicInterval< TraitsT > & i,
    DeltaT delta
)

function push_front🔗

1
2
3
4
5
6
template <typename TraitsT ,
typename DeltaT >
BasicInterval< TraitsT > push_front(
    const BasicInterval< TraitsT > & i,
    DeltaT delta
)

function pop_back🔗

1
2
3
4
5
6
template <typename TraitsT ,
typename DeltaT >
BasicInterval< TraitsT > pop_back(
    const BasicInterval< TraitsT > & i,
    DeltaT delta
)

function pop_front🔗

1
2
3
4
5
6
template <typename TraitsT ,
typename DeltaT >
BasicInterval< TraitsT > pop_front(
    const BasicInterval< TraitsT > & i,
    DeltaT delta
)

function make_interval🔗

1
2
3
4
5
6
template <typename T ,
typename U >
BasicInterval< IClosedOpen< std::decay_t< T >, std::decay_t< U > > > make_interval(
    T && lower,
    U && upper
)

function operator==🔗

1
2
3
4
5
6
template <typename TraitsL ,
typename TraitsR >
inline bool operator==(
    const BasicInterval< TraitsL > & l,
    const BasicInterval< TraitsR > & r
)

function operator!=🔗

1
2
3
4
5
6
template <typename TraitsL ,
typename TraitsR >
inline bool operator!=(
    const BasicInterval< TraitsL > & l,
    const BasicInterval< TraitsR > & r
)

function operator<<🔗

1
2
3
4
5
template <typename Traits >
inline std::ostream & operator<<(
    std::ostream & out,
    const BasicInterval< Traits > & t
)

function interval_traits_compatible🔗

1
2
3
template <typename Traits0 ,
typename Traits1 >
inline constexpr bool interval_traits_compatible()

function make_printable🔗

1
2
3
4
5
template <typename T ,
typename  =std::enable_if_t<IsPrintable<T>{}>>
decltype(auto) make_printable(
    T && obj
)

Returns a std::ostream-printable representation of the argument, obj.

This overload is selected for types that support an overloaded operator<< for std::ostream. It simply forwards the argument as the return value.

function make_printable🔗

1
2
3
4
5
6
template <typename T ,
typename  =std::enable_if_t<!IsPrintable<T>{}>,
typename  =void>
std::string make_printable(
    T && obj
)

Returns a std::ostream-printable representation of the argument, obj.

This overload is selected for all types that do not support an overloaded operator<< for std::ostream. It prints the name of the type (demangled), and a hex representation of the bytes of the object itself.

function log2_ceil🔗

1
2
3
inline constexpr i32 log2_ceil(
    u64 i
)

Returns log_2(i), rounded down to the nearest integer.

function log2_floor🔗

1
2
3
inline constexpr i32 log2_floor(
    u64 i
)

Returns log_2(i), rounded down to the nearest integer.

function lsb_mask🔗

1
2
3
4
template <typename IntT >
inline constexpr IntT lsb_mask(
    i32 bits
)

Least Significant Bits Mask.

Returns a value of type IntT with bits ones as the least significant bits, and zeros for all other bits.

function round_down_bits🔗

1
2
3
4
5
template <typename IntT >
inline constexpr IntT round_down_bits(
    i32 bits,
    IntT n
)

Rounds an integer value down to the nearest multiple of 2^bits.

For example, round_down_bits(8, n) will round n down to the nearest multiple of 256; if n is already a multiple of 256, it will return n.

function round_up_bits🔗

1
2
3
4
5
template <typename IntT >
inline constexpr IntT round_up_bits(
    i32 bits,
    IntT n
)

Rounds an integer value up to the nearest multiple of 2^bits.

For example, round_up_bits(8, n) will round n up to the nearest multiple of 256; if n is already a multiple of 256, it will return n.

function round_down_to🔗

1
2
3
4
5
template <typename IntT >
inline constexpr IntT round_down_to(
    IntT unit,
    IntT n
)

Rounds n down to the nearest multiple of unit.

function round_up_to🔗

1
2
3
4
5
template <typename IntT >
inline constexpr IntT round_up_to(
    IntT unit,
    IntT n
)

Rounds n up to the nearest multiple of unit.

function ipow🔗

1
2
3
4
5
6
template <typename IntT >
inline constexpr IntT ipow(
    IntT base,
    IntT exponent,
    IntT accumulator =static_cast< IntT >(1)
)

Compile-time integer exponentiation.

function bit_count🔗

1
2
3
inline i32 bit_count(
    u64 n
)

Returns the number of set (1) bits in the passed integer.

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const LatencyMetric & t
)

function normalize_labels🔗

1
2
3
inline MetricLabelSet normalize_labels(
    MetricLabelSet && labels
)

function global_metric_registry🔗

inline MetricRegistry & global_metric_registry()

function make_nullable🔗

1
2
3
4
template <typename T >
auto make_nullable(
    T && obj
)

function operator==🔗

1
2
3
4
inline bool operator==(
    const NoneType & ,
    const NoneType & 
)

function operator!=🔗

1
2
3
4
inline bool operator!=(
    const NoneType & ,
    const NoneType & 
)

function operator==🔗

1
2
3
4
5
6
template <typename T0 ,
typename T1 >
inline bool operator==(
    const Optional< T0 > & v0,
    const Optional< T1 > & v1
)

function operator!=🔗

1
2
3
4
5
6
template <typename T0 ,
typename T1 >
inline bool operator!=(
    const Optional< T0 > & v0,
    const Optional< T1 > & v1
)

function operator==🔗

1
2
3
4
5
6
template <typename T0 ,
typename T1 >
inline bool operator==(
    const Optional< T0 > & v0,
    const T1 & v1
)

function operator!=🔗

1
2
3
4
5
6
template <typename T0 ,
typename T1 >
inline bool operator!=(
    const Optional< T0 > & v0,
    const T1 & v1
)

function operator==🔗

1
2
3
4
5
6
template <typename T0 ,
typename T1 >
inline bool operator==(
    const T0 & v0,
    const Optional< T1 > & v1
)

function operator!=🔗

1
2
3
4
5
6
template <typename T0 ,
typename T1 >
inline bool operator!=(
    const T0 & v0,
    const Optional< T1 > & v1
)

function operator==🔗

1
2
3
4
5
template <typename T >
inline bool operator==(
    NoneType ,
    const Optional< T > & v
)

function operator!=🔗

1
2
3
4
5
template <typename T >
inline bool operator!=(
    NoneType ,
    const Optional< T > & v
)

function operator==🔗

1
2
3
4
5
template <typename T >
inline bool operator==(
    const Optional< T > & v,
    NoneType 
)

function operator!=🔗

1
2
3
4
5
template <typename T >
inline bool operator!=(
    const Optional< T > & v,
    NoneType 
)

function operator<<🔗

1
2
3
4
5
template <typename T >
inline std::ostream & operator<<(
    std::ostream & out,
    const Optional< T > & t
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const NoneType & 
)

function make_optional🔗

1
2
3
4
template <typename T >
Optional< std::decay_t< T > > make_optional(
    T && val
)

function get_or_panic🔗

1
2
3
4
template <typename T >
decltype(auto) get_or_panic(
    Optional< T > & opt
)

function get_or_panic🔗

1
2
3
4
template <typename T >
decltype(auto) get_or_panic(
    const Optional< T > & opt
)

function get_or_panic🔗

1
2
3
4
template <typename T >
decltype(auto) get_or_panic(
    Optional< T > && opt
)

function operator<<🔗

1
2
3
4
5
template <usize N_>
inline std::ostream & operator<<(
    std::ostream & out,
    const RadixQueue< N_ > & t
)

function operator<<🔗

1
2
3
4
5
template <typename T >
inline std::ostream & operator<<(
    std::ostream & out,
    const Ref< T > & t
)

function as_ref🔗

1
2
3
4
template <typename T >
Ref< T > as_ref(
    T & obj_ref
)

function as_cref🔗

1
2
3
4
template <typename T >
Ref< const T > as_cref(
    const T & obj_ref
)

function into_ref🔗

1
2
3
4
template <typename T >
Ref< T > into_ref(
    T * ptr
)

function into_cref🔗

1
2
3
4
template <typename T >
Ref< const T > into_cref(
    const T * ptr
)

function unwrap_ref🔗

1
2
3
4
template <typename T >
decltype(auto) unwrap_ref(
    Ref< T > & wrapper
)

function unwrap_ref🔗

1
2
3
4
template <typename T >
decltype(auto) unwrap_ref(
    Ref< T > const & wrapper
)

function unwrap_ref🔗

1
2
3
4
template <typename T >
decltype(auto) unwrap_ref(
    Ref< T > && wrapper
)

function unwrap_ref🔗

1
2
3
4
template <typename T >
decltype(auto) unwrap_ref(
    Ref< T > const && wrapper
)

function print_stack_trace_atexit_enabled🔗

inline bool & print_stack_trace_atexit_enabled()

function print_stack_trace_atexit🔗

inline void print_stack_trace_atexit()

function has_seq_requirements🔗

1
2
3
4
template <typename T >
inline constexpr bool has_seq_requirements(
    StaticType< T >  ={}
)

function skip_n🔗

1
2
3
inline SkipNBinder skip_n(
    usize n
)

function operator|🔗

1
2
3
4
5
6
template <typename Seq ,
typename  =EnableIfSeq<Seq>>
SkipN< Seq > operator|(
    Seq && seq,
    const SkipNBinder & binder
)

function as_seq🔗

1
2
3
4
5
6
template <typename T ,
typename  =decltype(std::declval<T>().front()),
typename  =decltype(std::declval<T>().drop_front())>
SubRangeSeq< T > as_seq(
    T && sub_range
)

function as_seq🔗

1
2
3
4
5
template <typename ForwardIter >
auto as_seq(
    ForwardIter && begin,
    ForwardIter && end
)

function as_seq🔗

1
2
3
4
5
6
template <typename VectorLike ,
typename  =decltype(std::declval<VectorLike>().data()),
typename  =decltype(std::declval<VectorLike>().size())>
auto as_seq(
    VectorLike && v
)

function vec_range🔗

1
2
3
4
5
6
7
template <typename T ,
typename Begin  =decltype(std::declval<const T&>().data()),
typename End  =decltype(std::declval<Begin>() + std::declval<const T&>().size()),
typename  =std::enable_if_t<std::is_same_v<Begin, End>>>
auto vec_range(
    const T & vec
)

function into_seq🔗

1
2
3
4
template <typename T >
auto into_seq(
    std::vector< T > && v
)

function seq_ref🔗

1
2
3
4
template <typename SeqT >
SeqRef< SeqT > seq_ref(
    SeqT & seq
)

function make_shared🔗

1
2
3
4
5
6
template <typename T ,
typename... Args,
typename  =std::enable_if_t<IsRefCounted<T>{}>>
SharedPtr< T > make_shared(
    Args &&... args
)

function make_shared🔗

1
2
3
4
5
6
7
template <typename T ,
typename... Args,
typename  =std::enable_if_t<!IsRefCounted<T>{}>,
typename  =void>
SharedPtr< T > make_shared(
    Args &&... args
)

function into_shared🔗

1
2
3
4
template <typename T >
SharedPtr< T > into_shared(
    std::unique_ptr< T > && ptr
)

function shared_ptr_from🔗

1
2
3
4
5
template <typename T ,
typename  =std::enable_if_t<                          std::is_same_v<SharedPtr<T>, std::shared_ptr<std::remove_reference_t<T>>>>>
SharedPtr< T > shared_ptr_from(
    T * that
)

function shared_ptr_from🔗

1
2
3
4
5
6
template <typename T ,
typename  =std::enable_if_t<              std::is_same_v<SharedPtr<T>, boost::intrusive_ptr<std::remove_reference_t<T>>>>,
typename  =void>
SharedPtr< T > shared_ptr_from(
    T * that
)

function as_slice🔗

1
2
3
4
5
6
7
template <typename T ,
typename DataT  =decltype(std::declval<T>().data()),
typename  =std::enable_if_t<std::is_pointer_v<DataT>>,
typename ElementT  =typename std::pointer_traits<DataT>::element_type>
Slice< ElementT > as_slice(
    T && container
)

function as_slice🔗

1
2
3
4
5
template <typename ElementT >
Slice< ElementT > as_slice(
    ElementT * begin,
    ElementT * end
)

function as_slice🔗

1
2
3
4
5
template <typename ElementT >
Slice< ElementT > as_slice(
    ElementT * begin,
    usize size
)

function as_slice🔗

1
2
3
4
template <typename ElementT >
Slice< ElementT > as_slice(
    const Slice< ElementT > & slice
)

function as_const_slice🔗

1
2
3
4
5
template <typename ElementT >
Slice< const ElementT > as_const_slice(
    const ElementT * begin,
    const ElementT * end
)

function as_const_slice🔗

1
2
3
4
5
template <typename ElementT >
Slice< const ElementT > as_const_slice(
    const ElementT * begin,
    usize size
)

function as_const_slice🔗

1
2
3
4
5
6
7
template <typename T ,
typename DataT  =decltype(std::declval<const T&>().data()),
typename  =std::enable_if_t<std::is_pointer_v<DataT>>,
typename ElementT  =typename std::pointer_traits<DataT>::element_type>
Slice< const ElementT > as_const_slice(
    const T & container
)

function empty_slice🔗

1
2
3
4
template <typename ElementT >
Slice< ElementT > empty_slice(
    StaticType< ElementT >  ={}
)

function as_seq🔗

1
2
3
4
template <typename T >
SubRangeSeq< Slice< T > > as_seq(
    const Slice< T > & s
)

function as_seq🔗

1
2
3
4
template <typename T >
auto as_seq(
    Slice< T > & s
)

function as_seq🔗

1
2
3
4
template <typename T >
auto as_seq(
    Slice< T > && s
)

function as_seq🔗

1
2
3
4
template <typename T >
auto as_seq(
    const Slice< T > && s
)

function as_range🔗

1
2
3
4
template <typename Iter >
boost::iterator_range< Iter > as_range(
    const std::pair< Iter, Iter > & p
)

function slice_range🔗

1
2
3
4
5
6
7
8
template <typename RangeT ,
typename Iter  =std::decay_t<decltype(boost::begin(std::declval<RangeT>()))>,
typename OffsetT ,
typename  =std::enable_if_t<std::is_integral_v<OffsetT>>>
boost::iterator_range< Iter > slice_range(
    RangeT && range,
    const Interval< OffsetT > & i
)

function copy_string🔗

1
2
3
4
inline void copy_string(
    SmallVecBase< char > & dst,
    const std::string_view & src
)

function as_str🔗

1
2
3
inline std::string_view as_str(
    const SmallVecBase< char > & v
)

function extra_segv_debug_info_callback🔗

inline std::atomic< PrintToStreamFunctionPointer > & extra_segv_debug_info_callback()

function print_stack_trace🔗

inline void print_stack_trace()

function operator<<🔗

1
2
3
4
5
6
7
template <typename StateT ,
typename StateHash ,
typename StateEqual >
inline std::ostream & operator<<(
    std::ostream & out,
    const StateMachineBranch< StateT, StateHash, StateEqual > & t
)

function operator==🔗

1
2
3
4
5
6
7
template <typename StateT ,
typename StateHash ,
typename StateEqual >
inline bool operator==(
    const StateMachineBranch< StateT, StateHash, StateEqual > & l,
    const StateMachineBranch< StateT, StateHash, StateEqual > & r
)

function hash_value🔗

1
2
3
4
5
6
template <typename StateT ,
typename StateHash ,
typename StateEqual >
inline usize hash_value(
    const StateMachineBranch< StateT, StateHash, StateEqual > & branch
)

function combine_results🔗

1
2
3
4
inline StateMachineResult combine_results(
    const StateMachineResult & a,
    const StateMachineResult & b
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const StateMachineResult & r
)

function static_dispatch🔗

1
2
3
4
5
6
7
8
9
template <typename IntT ,
IntT kBegin,
IntT kEnd,
typename Fn ,
typename R  =decltype(std::declval<Fn>()(std::integral_constant<IntT, kBegin>{}))>
R static_dispatch(
    IntT i,
    Fn && fn
)

function static_dispatch🔗

1
2
3
4
5
template <typename Fn >
decltype(auto) static_dispatch(
    bool b,
    Fn && fn
)

function static_dispatch🔗

1
2
3
4
5
6
template <typename Tuple ,
typename Fn >
decltype(auto) static_dispatch(
    std::size_t i,
    Fn && fn
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const Status & t
)

function operator==🔗

1
2
3
4
inline bool operator==(
    const Status & l,
    const Status & r
)

function operator!=🔗

1
2
3
4
inline bool operator!=(
    const Status & l,
    const Status & r
)

function OkStatus🔗

inline Status OkStatus()

function operator==🔗

1
2
3
4
5
6
7
template <typename T ,
typename U ,
typename  =std::enable_if_t<CanBeEqCompared<T, U>{}>>
inline bool operator==(
    const StatusOr< T > & l,
    const StatusOr< U > & r
)

function operator==🔗

1
2
3
4
5
6
7
8
template <typename T ,
typename U ,
typename  =std::enable_if_t<!CanBeEqCompared<T, U>{}>,
typename  =void>
inline bool operator==(
    const StatusOr< T > & l,
    const StatusOr< U > & r
)

function operator!=🔗

1
2
3
4
5
6
template <typename T ,
typename U >
inline bool operator!=(
    const StatusOr< T > & l,
    const StatusOr< U > & r
)

function is_ok_status🔗

1
2
3
inline bool is_ok_status(
    const std::error_code & ec
)

function is_ok_status🔗

1
2
3
4
template <typename T >
bool is_ok_status(
    const T & val
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    LogLevel t
)

function require_fail_global_default_log_level🔗

inline std::atomic< LogLevel > & require_fail_global_default_log_level()

function require_fail_thread_default_log_level🔗

inline Optional< LogLevel > & require_fail_thread_default_log_level()

function status_from_errno🔗

1
2
3
inline Status status_from_errno(
    int code
)

function to_status🔗

1
2
3
4
5
template <typename T ,
typename  =std::enable_if_t<IsStatusOr<T>{} && !std::is_same_v<std::decay_t<T>, StatusOr<Status>>>>
inline decltype(auto) to_status(
    T && v
)

function to_status🔗

1
2
3
4
5
6
template <typename T ,
typename  =std::enable_if_t<std::is_same_v<std::decay_t<T>, Status> ||                                      std::is_same_v<std::decay_t<T>, StatusOr<Status>>>,
typename  =void>
inline decltype(auto) to_status(
    T && s
)

function register_error_category🔗

1
2
3
4
5
6
template <typename EnumT >
bool register_error_category(
    const boost::system::error_category & category,
    const std::vector< EnumT > & codes,
    batt::StaticType< EnumT >  ={}
)

Registers a custom error_category so that error_code objects that use it can be converted to batt::Status via batt::to_status.

Parameters:

  • category The category to register
  • codes A list of error code values (int or enum type) to register

Return: true (to indicate the registration was successful)

function status_from_error_category🔗

1
2
3
4
inline Status status_from_error_category(
    const boost::system::error_category & category,
    int code
)

Constructs and returns a batt::Status equivalent to the given code in the given category.

Return: the registered batt::Status value if code is valid; batt::StatusCode::kUnknown otherwise

The passed category must have been registered via batt::register_error_category prior to calling this function.

function status_from_error_code🔗

1
2
3
inline Status status_from_error_code(
    const boost::system::error_code & ec
)

Constructs and returns a batt::Status equivalent to the given error_code.

Return: the registered batt::Status value if code is valid; batt::StatusCode::kUnknown otherwise

The error_category of the passed object must have been registered via batt::register_error_category prior to calling this function.

function error_code_to_status🔗

1
2
3
inline Status error_code_to_status(
    const std::error_code & ec
)

function error_code_to_status🔗

1
2
3
inline Status error_code_to_status(
    const boost::system::error_code & ec
)

function to_status🔗

1
2
3
4
5
6
7
template <typename T ,
typename  =std::enable_if_t<std::is_same_v<std::decay_t<T>, std::error_code> ||                                      std::is_same_v<std::decay_t<T>, boost::system::error_code>>,
typename  =void,
typename  =void>
inline Status to_status(
    const T & ec
)

Converts an error_code (boost::system:: or std::) to a batt::Status value.

function to_status🔗

1
2
3
4
5
6
7
8
template <typename T ,
typename  =std::enable_if_t<std::is_same_v<std::decay_t<T>, boost::asio::error::basic_errors> ||                                      std::is_same_v<std::decay_t<T>, boost::asio::error::netdb_errors> ||                                      std::is_same_v<std::decay_t<T>, boost::asio::error::addrinfo_errors> ||                                      std::is_same_v<std::decay_t<T>, boost::asio::error::misc_errors>>,
typename  =void,
typename  =void,
typename  =void>
inline Status to_status(
    T && code_value
)

function status_from_retval🔗

1
2
3
4
template <typename T >
inline Status status_from_retval(
    T retval
)

function ok_result_or_panic🔗

1
2
3
4
template <typename T >
inline T && ok_result_or_panic(
    StatusOr< T > && result
)

function operator<<🔗

1
2
3
4
5
6
template <typename T ,
typename  =std::enable_if_t<IsStatusOr<std::decay_t<T>>{} &&                                                  !std::is_same_v<std::decay_t<T>, StatusOr<Status>>>>
std::ostream & operator<<(
    std::ostream & out,
    T && status_or
)

function status_is_retryable🔗

1
2
3
inline bool status_is_retryable(
    const Status & s
)

function print_all🔗

1
2
3
inline std::ostream & print_all(
    std::ostream & out
)

function print_all🔗

1
2
3
4
5
6
7
template <typename First ,
typename... Rest>
std::ostream & print_all(
    std::ostream & out,
    First && first,
    Rest &&... rest
)

function extract_all🔗

1
2
3
inline std::istream & extract_all(
    std::istream & in
)

function extract_all🔗

1
2
3
4
5
6
7
template <typename First ,
typename... Rest>
std::istream & extract_all(
    std::istream & in,
    First && first,
    Rest &&... rest
)

function to_string🔗

1
2
3
4
template <typename... Args>
std::string to_string(
    Args &&... args
)

function from_string🔗

1
2
3
4
5
6
template <typename T ,
typename... FormatArgs>
std::optional< T > from_string(
    const std::string & str,
    FormatArgs &&... format_args
)

function c_str_literal🔗

1
2
3
inline EscapedStringLiteral c_str_literal(
    const std::string_view & str
)

function c_str_literal🔗

1
2
3
4
5
template <typename T ,
typename  =std::enable_if_t<std::is_convertible_v<T, std::string_view>>>
inline Optional< EscapedStringLiteral > c_str_literal(
    const Optional< T > & maybe_str
)

function c_str_literal🔗

1
2
3
inline Optional< EscapedStringLiteral > c_str_literal(
    const NoneType & 
)

function make_printable🔗

1
2
3
inline decltype(auto) make_printable(
    std::string & str
)

function make_printable🔗

1
2
3
inline decltype(auto) make_printable(
    std::string && str
)

function make_printable🔗

1
2
3
inline decltype(auto) make_printable(
    const std::string & str
)

function make_printable🔗

1
2
3
inline decltype(auto) make_printable(
    const std::string && str
)

function make_printable🔗

1
2
3
inline decltype(auto) make_printable(
    std::string_view & str
)

function make_printable🔗

1
2
3
inline decltype(auto) make_printable(
    std::string_view && str
)

function make_printable🔗

1
2
3
inline decltype(auto) make_printable(
    const std::string_view & str
)

function make_printable🔗

1
2
3
inline decltype(auto) make_printable(
    const std::string_view && str
)

function StringUpperBound🔗

inline const std::string_view & StringUpperBound()

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const EscapedStringLiteral & t
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const HexByteDumper & t
)

function dump_hex🔗

1
2
3
4
inline HexByteDumper dump_hex(
    const void * ptr,
    usize size
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    SizeDumper t
)

function dump_size🔗

1
2
3
inline SizeDumper dump_size(
    usize n
)

function dump_size_exact🔗

1
2
3
inline SizeDumper dump_size_exact(
    usize n
)

function parse_byte_size🔗

1
2
3
inline Optional< usize > parse_byte_size(
    std::string_view s
)

Parse a byte size string with optional units.

Return: The parse size in bytes if successful, None otherwise.

Units can be any of:

  • 'b': bytes
  • 'kb': kilobytes (=1024 bytes)
  • 'mb': megabytes (=1024 kilobytes)
  • 'gb': gigabytes (=1024 megabytes)
  • 'tb': terabytes (=1024 gigabytes)
  • 'pb': petabytes (=1024 terabtyes)
  • 'eb': eitabytes (=1024 petabytes) The unit string may be upper or lower case, and only the first character is considered, so the string "45k" will parse the same as "45KILOBYTES" or "45Kb", etc.

Simple addition and subtraction will also be evaluated, so for example, the string "16mb-1" will parse to the value 16 * 1024 * 1024 - 1. No space is allowed between additive terms when using this notation.

function dump_range🔗

1
2
3
4
5
template <typename T >
RangeDumper< const T & > dump_range(
    const T & value,
    Pretty pretty =Pretty::Default
)

function pretty_print_indent🔗

inline auto pretty_print_indent()

function is_strong_type🔗

1
2
3
4
template <typename T >
inline constexpr bool is_strong_type(
    StaticType< T >  ={}
)

function operator+🔗

1
2
3
4
5
6
7
template <typename T ,
typename Tag ,
typename  =std::enable_if_t<batt_strong_typedef_supports_numerics((Tag*)nullptr)>>
constexpr StrongType< T, Tag > operator+(
    StrongType< T, Tag > a,
    StrongType< T, Tag > b
)

function operator-🔗

1
2
3
4
5
6
7
template <typename T ,
typename Tag ,
typename  =std::enable_if_t<batt_strong_typedef_supports_numerics((Tag*)nullptr)>>
constexpr StrongType< T, Tag > operator-(
    StrongType< T, Tag > a,
    StrongType< T, Tag > b
)

function operator*🔗

1
2
3
4
5
6
7
template <typename T ,
typename Tag ,
typename  =std::enable_if_t<batt_strong_typedef_supports_numerics((Tag*)nullptr)>>
constexpr StrongType< T, Tag > operator*(
    StrongType< T, Tag > a,
    StrongType< T, Tag > b
)

function operator/🔗

1
2
3
4
5
6
7
template <typename T ,
typename Tag ,
typename  =std::enable_if_t<batt_strong_typedef_supports_numerics((Tag*)nullptr)>>
constexpr StrongType< T, Tag > operator/(
    StrongType< T, Tag > a,
    StrongType< T, Tag > b
)

function syscall_retry🔗

1
2
3
4
template <typename Op >
auto syscall_retry(
    Op && op
)

function operator==🔗

1
2
3
4
5
6
template <typename L ,
typename R >
inline constexpr bool operator==(
    StaticType< L > ,
    StaticType< R > 
)

function operator!=🔗

1
2
3
4
5
6
template <typename L ,
typename R >
inline constexpr bool operator!=(
    StaticType< L > ,
    StaticType< R > 
)

function is_any_true🔗

inline constexpr bool is_any_true()

Returns true iff any of the passed arguments evaluates to true (base case; always returns false).

function is_any_true🔗

1
2
3
4
5
template <typename... Rest>
inline constexpr bool is_any_true(
    bool first,
    Rest &&... rest
)

Returns true iff any of the passed arguments evaluates to true (recursive case; short circuits if first is true.).

function are_all_true🔗

inline constexpr bool are_all_true()

Returns true iff all of the passed arguments evaluate to true (base case; always returns false).

function are_all_true🔗

1
2
3
4
5
template <typename... Rest>
inline constexpr bool are_all_true(
    bool first,
    Rest &&... rest
)

Returns true iff any of the passed arguments evaluates to true (recursive case; short circuits if first is true.).

function name_of🔗

1
2
3
inline const char * name_of(
    const std::type_index & index
)

Calculates and returns the demangled name of the given type as a null-terminated C-string.

function name_of🔗

1
2
3
inline const char * name_of(
    const std::type_info & info
)

Calculates and returns the demangled name of the given type as a null-terminated C-string.

function name_of🔗

1
2
3
4
template <typename T >
const char * name_of(
    batt::StaticType< T >  ={}
)

Calculates and returns the demangled name of the given type as a null-terminated C-string.

function unqualified_name_of🔗

1
2
3
4
template <typename T >
const char * unqualified_name_of(
    batt::StaticType< T >  ={}
)

Calculates and returns the demangled name of the given type, without the namespace qualifier.

function can_be_empty_base🔗

1
2
3
4
5
template <typename T ,
typename  =std::enable_if_t<std::is_class_v<T>>>
inline constexpr auto can_be_empty_base(
    StaticType< T >  ={}
)

Returns true iff the specified type can be optimized to zero size via empty base class optimization.

function can_be_empty_base🔗

1
2
3
4
5
6
template <typename T ,
typename  =std::enable_if_t<!std::is_class_v<T>>,
typename  =void>
inline constexpr std::false_type can_be_empty_base(
    StaticType< T >  ={}
)

function operator==🔗

1
2
3
4
inline bool operator==(
    const UrlParse & left,
    const UrlParse & right
)

function operator!=🔗

1
2
3
4
inline bool operator!=(
    const UrlParse & left,
    const UrlParse & right
)

function operator<<🔗

1
2
3
4
inline std::ostream & operator<<(
    std::ostream & out,
    const UrlParse & t
)

function parse_url🔗

1
2
3
inline StatusOr< UrlParse > parse_url(
    std::string_view url
)

function make_copy🔗

1
2
3
4
template <typename T >
T make_copy(
    const T & value
)

Return a copy of value.

Supports the "sunk arguments idiom" of always declaring function arguments whose value is copied/retained by the callee as rvalue-references. This idiom maintains optimal efficiency in most cases while providing a signal-boost at call sites that an arg is being copied or moved. Examples:

struct MyStruct {
  std::shared_ptr<bool> p_flag;

  explicit MyStruct(std::shared_ptr<bool> &&arg) : p_flag{std::move(arg)} {}
};

// These are allowed:
//
MyStruct ex1{std::make_shared<bool>(true)};

auto flag_arg = std::make_shared<bool>(false);
MyStruct ex2{batt::make_copy(flag_arg)};
MyStruct ex3{std::move(flag_arg)};

// This is not allowed (the caller must declare intent loudly):
//
auto flag_arg2 = std::make_shared<bool>(true);
MyStruct ex4_BAD{flag_arg2};

function sink🔗

1
2
3
4
5
template <typename T ,
typename  =std::enable_if_t<std::is_same_v<T, std::decay_t<T>>>>
T && sink(
    T && value
)

function sink🔗

1
2
3
4
template <typename T >
T sink(
    const T & value
)

function make_default🔗

1
2
3
template <typename T ,
typename  =std::enable_if_t<!std::is_same_v<T, void>>>
T make_default()

Return a default-constructed instance of type T.

function make_default🔗

1
2
3
4
template <typename T ,
typename  =std::enable_if_t<std::is_same_v<T, void>>,
typename  =void>
void make_default()

function unwrap_ref🔗

1
2
3
4
template <typename T >
decltype(auto) unwrap_ref(
    T && obj
)

function unwrap_ref🔗

1
2
3
4
template <typename T >
decltype(auto) unwrap_ref(
    std::reference_wrapper< T > & wrapper
)

function unwrap_ref🔗

1
2
3
4
template <typename T >
decltype(auto) unwrap_ref(
    std::reference_wrapper< T > const & wrapper
)

function unwrap_ref🔗

1
2
3
4
template <typename T >
decltype(auto) unwrap_ref(
    std::reference_wrapper< T > && wrapper
)

function unwrap_ref🔗

1
2
3
4
template <typename T >
decltype(auto) unwrap_ref(
    std::reference_wrapper< T > const && wrapper
)

function rotate_args_right🔗

1
2
3
4
5
6
template <typename Fn ,
typename... Args>
decltype(auto) rotate_args_right(
    Fn && fn,
    Args &&... args
)

function rotate_args_left🔗

1
2
3
4
5
6
template <typename Fn ,
typename... Args>
decltype(auto) rotate_args_left(
    Fn && fn,
    Args &&... args
)

Attributes Documentation🔗

variable kMinStackSizeLog2🔗

constexpr usize kMinStackSizeLog2 = 10u;

variable kMaxStackSizeLog2🔗

constexpr usize kMaxStackSizeLog2 = 32u;

variable kMaxDebugInfoThreads🔗

constexpr usize kMaxDebugInfoThreads = 32;

variable kTaskDebugInfoSegvCallbackInstalled🔗

1
2
3
4
const bool kTaskDebugInfoSegvCallbackInstalled = [] {
    extra_segv_debug_info_callback() = &this_task_debug_info;
    return true;
}();

variable kCpuCacheLineSize🔗

constexpr auto kCpuCacheLineSize = usize{64};

variable kSigSegvHandlerInstalled🔗

1
2
3
4
5
6
const bool kSigSegvHandlerInstalled = [] {
    signal(SIGSEGV, &detail::handle_segv);
    signal(SIGABRT, &detail::handle_segv);
    std::atexit(&print_stack_trace_atexit);
    return true;
}();

variable kDefaultSmallVecSize🔗

constexpr usize kDefaultSmallVecSize = 4;

variable IsStatusEnum🔗

1
2
3
4
5
constexpr bool IsStatusEnum = std::is_enum_v<T> &&                                  
                              !boost::system::is_error_code_enum<T>::value &&       
                              !boost::system::is_error_condition_enum<T>::value &&  
                              !std::is_error_code_enum_v<T> &&                      
                              !std::is_error_condition_enum_v<T>;

variable TupleIndexOf_v🔗

constexpr auto TupleIndexOf_v = TupleIndexOf<std::decay_t<TupleT>, T>::value;

variable IsOneOf🔗

constexpr bool IsOneOf = is_any_true(std::is_same_v<T, MatchTs>...);

Trait that evaluates to true iff T is the same as one of the MatchTs.

variable DecaysToOneOf🔗

constexpr bool DecaysToOneOf = IsOneOf<std::decay_t<T>, MatchTs...>;

Trait that evaluates to true iff T decays to one of the MatchTs.


Updated on 31 January 2025 at 21:21:04 UTC