Public Types | Static Public Member Functions | List of all members
util::quantities::concepts::Prefix< R > Struct Template Reference

#include <quantities.h>

Public Types

using ratio = R
 The ratio this prefix is about. More...
 

Static Public Member Functions

static constexpr auto names (bool Long=false)
 Returns the unit symbol (Long false) or name (Long true). More...
 
static constexpr auto symbol ()
 Returns the symbol of the prefix. More...
 
static constexpr auto name ()
 Returns the full name of the prefix. More...
 

Detailed Description

template<typename R>
struct util::quantities::concepts::Prefix< R >

Definition at line 378 of file quantities.h.

Member Typedef Documentation

template<typename R >
using util::quantities::concepts::Prefix< R >::ratio = R

The ratio this prefix is about.

Definition at line 379 of file quantities.h.

Member Function Documentation

template<typename R >
static constexpr auto util::quantities::concepts::Prefix< R >::name ( )
inlinestatic

Returns the full name of the prefix.

Definition at line 388 of file quantities.h.

388 { return names(true); }
static constexpr auto names(bool Long=false)
Returns the unit symbol (Long false) or name (Long true).
Definition: quantities.h:1251
template<typename R >
constexpr auto util::quantities::concepts::Prefix< R >::names ( bool  Long = false)
static

Returns the unit symbol (Long false) or name (Long true).

Definition at line 1251 of file quantities.h.

1252 {
1253  if constexpr(std::is_same<ratio, std::tera>())
1254  return Long? "tera"sv: "T"sv;
1255  if constexpr(std::is_same<ratio, std::giga>())
1256  return Long? "giga"sv: "G"sv;
1257  if constexpr(std::is_same<ratio, std::mega>())
1258  return Long? "mega"sv: "M"sv;
1259  if constexpr(std::is_same<ratio, std::kilo>())
1260  return Long? "kilo"sv: "k"sv;
1261  if constexpr(std::is_same<ratio, std::ratio<1>>())
1262  return ""sv;
1263  if constexpr(std::is_same<ratio, std::deci>())
1264  return Long? "deci"sv: "d"sv;
1265  if constexpr(std::is_same<ratio, std::centi>())
1266  return Long? "centi"sv: "c"sv;
1267  if constexpr(std::is_same<ratio, std::milli>())
1268  return Long? "milli"sv: "m"sv;
1269  if constexpr(std::is_same<ratio, std::micro>())
1270  return Long? "micro"sv: "u"sv;
1271  if constexpr(std::is_same<ratio, std::nano>())
1272  return Long? "nano"sv: "n"sv;
1273  if constexpr(std::is_same<ratio, std::pico>())
1274  return Long? "pico"sv: "p"sv;
1275  if constexpr(std::is_same<ratio, std::femto>())
1276  return Long? "femto"sv: "f"sv;
1277  // TODO complete the long list of prefixes
1278 
1279  // backup; can't use `to_string()` because of `constexpr` requirement
1280  return Long? "???"sv: "?"sv;
1281 } // util::quantities::concepts::Prefix<R>::names()
STL namespace.
std::void_t< T > n
p
Definition: test.py:223
R ratio
The ratio this prefix is about.
Definition: quantities.h:379
if(!yymsg) yymsg
template<typename R >
static constexpr auto util::quantities::concepts::Prefix< R >::symbol ( )
inlinestatic

Returns the symbol of the prefix.

Definition at line 385 of file quantities.h.

385 { return names(false); }
static constexpr auto names(bool Long=false)
Returns the unit symbol (Long false) or name (Long true).
Definition: quantities.h:1251

The documentation for this struct was generated from the following file: