libfxd 0.2.dev
A fixed-point library for C++.
Loading...
Searching...
No Matches
fxd::expect Namespace Reference

Return fxd::expect::maybe<...> result. More...

Namespaces

namespace  down
 Round down.
 
namespace  up
 Round up.
 
namespace  zero
 Round to zero.
 

Typedefs

template<typename T >
using maybe = detail::expected< T, error >
 Alias to std::expected, or an equivalent implementation.
 

Functions

template<int Int, int Frac, typename Raw = detail::select_int_t<Int + Frac>, std::convertible_to< fixed< Int, Frac, Raw > > Src>
constexpr maybe< fixed< Int, Frac, Raw > > make_fixed (Src src)
 Convenience overload.
 
template<int Int, int Frac, typename Raw = detail::select_uint_t<Int + Frac>, std::convertible_to< fixed< Int, Frac, Raw > > Src>
constexpr maybe< fixed< Int, Frac, Raw > > make_ufixed (Src src)
 Convenience overload (unsigned version).
 
template<int Int, int Frac, typename Raw = fxd::detail::select_int_t<Int + Frac>, fixed_point Src>
constexpr maybe< fixed< Int, Frac, Raw > > fixed_cast (Src src) noexcept
 Convenience overload.
 
template<int Int, int Frac, typename Raw = fxd::detail::select_uint_t<Int + Frac>, fixed_point Src>
constexpr maybe< fixed< Int, Frac, Raw > > ufixed_cast (Src src) noexcept
 Convenience overload (unsigned version).
 
template<fixed_point Dst, std::convertible_to< Dst > Src>
constexpr maybe< Dst > assign (Dst &dst, Src src) noexcept
 Assignment.
 
template<fixed_point Fxd>
constexpr maybe< Fxd > pre_inc (Fxd &f) noexcept
 Pre-increment (++f).
 
template<fixed_point Fxd>
constexpr maybe< Fxd > post_inc (Fxd &f) noexcept
 Post-increment (f++).
 
template<fixed_point Fxd>
constexpr maybe< Fxd > pre_dec (Fxd &f) noexcept
 Pre-decrement (--f).
 
template<fixed_point Fxd>
constexpr maybe< Fxd > post_dec (Fxd &f) noexcept
 Post-decrement (f--).
 

Detailed Description

Return fxd::expect::maybe<...> result.

Typedef Documentation

◆ maybe

using maybe = detail::expected<T, error>

Alias to std::expected, or an equivalent implementation.

Definition at line 27 of file expect.hpp.

Function Documentation

◆ assign()

constexpr maybe< Dst > assign ( Dst &  dst,
Src  src 
)
constexprnoexcept

Assignment.

Note
This does not return a reference to the argument, only a copy.

Definition at line 105 of file expect.hpp.

◆ fixed_cast()

constexpr maybe< fixed< Int, Frac, Raw > > fixed_cast ( Src  src)
constexprnoexcept

Convenience overload.

Definition at line 70 of file expect.hpp.

◆ make_fixed()

constexpr maybe< fixed< Int, Frac, Raw > > make_fixed ( Src  src)
constexpr

Convenience overload.

Definition at line 40 of file expect.hpp.

◆ make_ufixed()

constexpr maybe< fixed< Int, Frac, Raw > > make_ufixed ( Src  src)
constexpr

Convenience overload (unsigned version).

Definition at line 53 of file expect.hpp.

◆ post_dec()

constexpr maybe< Fxd > post_dec ( Fxd &  f)
constexprnoexcept

Post-decrement (f--).

Definition at line 171 of file expect.hpp.

◆ post_inc()

constexpr maybe< Fxd > post_inc ( Fxd &  f)
constexprnoexcept

Post-increment (f++).

Definition at line 138 of file expect.hpp.

◆ pre_dec()

constexpr maybe< Fxd > pre_dec ( Fxd &  f)
constexprnoexcept

Pre-decrement (--f).

Note
This does not return a reference to the argument, only a copy.

Definition at line 157 of file expect.hpp.

◆ pre_inc()

constexpr maybe< Fxd > pre_inc ( Fxd &  f)
constexprnoexcept

Pre-increment (++f).

Note
This does not return a reference to the argument, only a copy.

Definition at line 124 of file expect.hpp.

◆ ufixed_cast()

constexpr maybe< fixed< Int, Frac, Raw > > ufixed_cast ( Src  src)
constexprnoexcept

Convenience overload (unsigned version).

Definition at line 85 of file expect.hpp.