Page MenuHomec4science

units.cc
No OneTemporary

File Metadata

Created
Sat, Nov 16, 00:57

units.cc

/**
* file units.cc
*
* @author Till Junge <till.junge@epfl.ch>
*
* @date 04 May 2017
*
* @brief Definition of unit-related literals (have to be compiled only once!
*
* @section LICENCE
*
* Copyright (C) 2017 Till Junge
*
* µSpectre is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3, or (at
* your option) any later version.
*
* µSpectre is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Emacs; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "common/units.hh"
namespace muSpectre {
//----------------------------------------------------------------------------//
//! string literals for convenient use of units
#define LITERAL(literal_string) \
Quantity<Real, units::literal_string> operator""_##literal_string(long double r) { \
return Quantity<Real, units::literal_string>(Real(r)); \
} \
Quantity<Real, units::literal_string> operator""_##literal_string(unsigned long long r) { \
return Quantity<Real, units::literal_string>(Real(r)); \
}
// Warning: no literals seem possible for complex scalars
#define MACRO(r, dummy, literal_string) LITERAL(literal_string)
BOOST_PP_SEQ_FOR_EACH(MACRO, _, LITERALS)
} // muSpectre

Event Timeline