/** * @file Scalar.hpp * * Defines conversion of matrix to scalar. * * @author James Goppert */ #pragma once #include "math.hpp" namespace matrix { template class Scalar { public: Scalar() = delete; Scalar(const Matrix & other) : _value{other(0,0)} { } Scalar(Type other) : _value(other) { } operator const Type &() { return _value; } operator Matrix() const { Matrix m; m(0, 0) = _value; return m; } operator Vector() const { Vector m; m(0) = _value; return m; } private: const Type _value; }; typedef Scalar Scalarf; } // namespace matrix /* vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : */