github.com/enetx/g@v1.0.80/pkg/deref/of.go (about) 1 // Package deref provides a utility function to dereference a pointer. 2 package deref 3 4 // Of takes a pointer to a value of any type E and returns the value it points to. 5 // This function can be useful for simplifying code when working with pointers and their values. 6 // 7 // Parameters: 8 // 9 // e: A pointer to a value of any type E. 10 // 11 // Returns: 12 // 13 // E: The value pointed to by the input pointer. 14 // 15 // Example usage: 16 // 17 // pi := 3.141592 18 // ptr := &pi 19 // value := deref.Of(ptr) // value is 3.141592 (type float64) 20 func Of[E any](e *E) E { return *e }