operator

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add[T core.Numeric | ~string](lhs T, rhs T) T

Add act same as lhs + rhs.

func AddAssign

func AddAssign[T core.Numeric | ~string](lhs *T, rhs T)

AddAssign act same as lhs += rhs in place.

func And

func And[T ~bool](lhs T, rhs T) T

And act same as lhs && rhs.

func AndAssign

func AndAssign[T ~bool](lhs *T, rhs T)

AndAssign act same as lhs &&= rhs in place.

func BitAnd

func BitAnd[T core.Integer](lhs T, rhs T) T

BitAnd act same as lhs & rhs.

func BitAndAssign

func BitAndAssign[T core.Integer](lhs *T, rhs T)

BitAndAssign act same as lhs &= rhs in place.

func BitOr

func BitOr[T core.Integer](lhs T, rhs T) T

BitOr act same as lhs | rhs.

func BitOrAssign

func BitOrAssign[T core.Integer](lhs *T, rhs T)

BitOrAssign act same as lhs |= rhs in place.

func BitXor

func BitXor[T core.Integer](lhs T, rhs T) T

BitXor act same as lhs ^ rhs.

func BitXorAssign

func BitXorAssign[T core.Integer](lhs *T, rhs T)

BitXorAssign act same as lhs ^= rhs in place.

func Div

func Div[T core.Numeric](lhs T, rhs T) T

Div act same as lhs / rhs.

func DivAssign

func DivAssign[T core.Numeric](lhs *T, rhs T)

DivAssign act same as lhs /= rhs in place.

func Eq

func Eq[T comparable](lhs T, rhs T) bool

Eq test two value whether equal or not.

if equal return true, otherwise return false.

func Exchange

func Exchange[Lhs, Rhs any](lhs Lhs, rhs Rhs) (Rhs, Lhs)

Exchange change order of the two value.

func Ge

func Ge[T core.Ordered](lhs T, rhs T) bool

Ge test whether lhs greater than or equal to rhs value.

if lhs greater than or equal to rhs, return true, otherwise return false.

func Gt

func Gt[T core.Ordered](lhs T, rhs T) bool

Gt test whether lhs greater than rhs value.

if lhs greater than rhs, return true, otherwise return false.

func Identify added in v0.5.0

func Identify[E any](x E) E

Identify return self.

func LazyTernary added in v0.4.0

func LazyTernary[T any](ok bool, lhs func() T, rhs func() T) T

func Le

func Le[T core.Ordered](lhs T, rhs T) bool

Le test whether lhs less than or equal to rhs value.

if lhs less than or equal to rhs, return true, otherwise return false.

func Lt

func Lt[T core.Ordered](lhs T, rhs T) bool

Lt test whether lhs less than rhs value.

if lhs less than rhs, return true, otherwise return false.

func Max

func Max[T core.Ordered](elem T, rest ...T) T

Max return maximum of the given values.

func Min

func Min[T core.Ordered](elem T, rest ...T) T

Min return minimum of the given values.

func Mul

func Mul[T core.Numeric](lhs T, rhs T) T

Mul act same as lhs * rhs.

func MulAssign

func MulAssign[T core.Numeric](lhs *T, rhs T)

MulAssign act same as lhs *= rhs in place.

func Ne

func Ne[T comparable](lhs T, rhs T) bool

Ne test two values whether equal or not.

if equal return false, otherwise return true.

func Neg

func Neg[T core.Numeric](v T) T

Neg return negative value of input value.

func Not

func Not[T ~bool](v T) T

Not act same as !v.

func NotAssign

func NotAssign[T ~bool](v *T)

NotAssign invert bool value in place.

func Or

func Or[T ~bool](lhs T, rhs T) T

Or act same as lhs || rhs.

func OrAssign

func OrAssign[T ~bool](lhs *T, rhs T)

OrAssign act same as lhs ||= rhs in place.

func RangeInteger

func RangeInteger[T core.Integer](start T, end T) []T

RangeInteger returns a slice that contains all integers in [start, end).

func Rem

func Rem[T core.Integer](lhs T, rhs T) T

Rem act same as lhs % rhs.

func RemAssign

func RemAssign[T core.Integer](lhs *T, rhs T)

RemAssign act same as lhs %= rhs in place.

func Shl

func Shl[T core.Integer, S core.Integer](v T, bit S) T

Shl act same as v << bit.

func ShlAssign

func ShlAssign[T core.Integer, S core.Integer](v *T, bit S)

ShlAssign act same as v <<= bit.

func Shr

func Shr[T core.Integer, S core.Integer](v T, bit S) T

Shr act same as v >> bit.

func ShrAssign

func ShrAssign[T core.Integer, S core.Integer](v *T, bit S)

ShrAssign act same as v >>= bit.

func Sub

func Sub[T core.Numeric](lhs T, rhs T) T

Sub act same as lhs - rhs.

func SubAssign

func SubAssign[T core.Numeric](lhs *T, rhs T)

SubAssign act same as lhs -= rhs in place.

func Ternary

func Ternary[T any](ok bool, lhs T, rhs T) T

Ternary act same as ok ? lhs : rhs.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL