Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jan Koniarik
emlabcpp
Commits
30151f41
Commit
30151f41
authored
Oct 17, 2021
by
Jan Koniarik
Browse files
added operator<< for quantity
parent
bb9bc6ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/emlabcpp/quantity.h
View file @
30151f41
...
...
@@ -7,6 +7,10 @@
#include <string>
#include <type_traits>
#ifdef EMLABCPP_USE_STREAMS
#include <ostream>
#endif
#pragma once
namespace
emlabcpp
...
...
@@ -233,6 +237,14 @@ constexpr ValueType operator/( const ValueType val, const quantity< Derived, Val
return
val
/
*
q
;
}
#ifdef EMLABCPP_USE_STREAMS
template
<
typename
T
,
typename
ValueType
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
quantity
<
T
,
ValueType
>
q
)
{
return
os
<<
*
q
<<
T
::
get_unit
();
}
#endif
}
// namespace emlabcpp
/// The quantity has defined partital specialization of std::numeric_limits,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment