Add examples for different utilities
This commit is contained in:
26
cpplinker/10_debug_linker/math_lib.hpp
Normal file
26
cpplinker/10_debug_linker/math_lib.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
namespace Math {
|
||||
|
||||
// Free functions — each becomes a mangled symbol, e.g.
|
||||
// Math::sqrt(double) → _ZN4Math4sqrtEd
|
||||
// Math::square(double) → _ZN4Math6squareEd
|
||||
// Math::cube(double) → _ZN4Math4cubeEd
|
||||
double sqrt(double x);
|
||||
double square(double x);
|
||||
double cube(double x);
|
||||
|
||||
// Class — member functions add even richer mangling
|
||||
class Vector2D {
|
||||
public:
|
||||
double x, y;
|
||||
|
||||
Vector2D(double x, double y);
|
||||
|
||||
double length() const;
|
||||
Vector2D add(const Vector2D& other) const;
|
||||
Vector2D scale(double factor) const;
|
||||
double dot(const Vector2D& other) const;
|
||||
};
|
||||
|
||||
} // namespace Math
|
||||
Reference in New Issue
Block a user