@@ -801,19 +801,19 @@ namespace detail {
801801
802802template <typename CharT, std::output_iterator<CharT> Out, Unit U>
803803 requires requires { U::_symbol_; }
804- constexpr Out unit_symbol_impl (Out out, U, const unit_symbol_formatting& fmt, bool negative_power)
804+ [[nodiscard]] constexpr Out unit_symbol_impl (Out out, U, const unit_symbol_formatting& fmt, bool negative_power)
805805{
806806 return copy_symbol<CharT>(U::_symbol_, fmt.char_set , negative_power, out);
807807}
808808
809809template <typename CharT, std::output_iterator<CharT> Out, auto M, typename U>
810- constexpr Out unit_symbol_impl (Out out, const scaled_unit_impl<M, U>& u, const unit_symbol_formatting& fmt ,
811- bool negative_power)
810+ [[nodiscard]] constexpr Out unit_symbol_impl (Out out, const scaled_unit_impl<M, U>& u,
811+ const unit_symbol_formatting& fmt, bool negative_power)
812812{
813813 *out++ = ' (' ;
814- magnitude_symbol<CharT>(out, M, fmt);
814+ out = magnitude_symbol<CharT>(out, M, fmt);
815815 if constexpr (space_before_unit_symbol<scaled_unit<M, U>::_reference_unit_>) *out++ = ' ' ;
816- unit_symbol_impl<CharT>(out, u._reference_unit_ , fmt, negative_power);
816+ out = unit_symbol_impl<CharT>(out, u._reference_unit_ , fmt, negative_power);
817817 *out++ = ' )' ;
818818 return out;
819819}
@@ -836,50 +836,50 @@ template<typename... Us, Unit U>
836836}
837837
838838template <typename CharT, std::output_iterator<CharT> Out, typename U, typename ... Rest>
839- constexpr Out unit_symbol_impl (Out out, const common_unit<U, Rest...>&, const unit_symbol_formatting& fmt,
840- bool negative_power)
839+ [[nodiscard]] constexpr Out unit_symbol_impl (Out out, const common_unit<U, Rest...>&, const unit_symbol_formatting& fmt,
840+ bool negative_power)
841841{
842842 constexpr std::string_view prefix (" [" );
843843 constexpr std::string_view separator (" , " );
844844 auto print_unit = [&]<Unit Arg>(Arg) {
845845 constexpr auto u = get_common_unit_in (common_unit<U, Rest...>{}, Arg{});
846- unit_symbol_impl<CharT>(out, u, fmt, negative_power);
846+ out = unit_symbol_impl<CharT>(out, u, fmt, negative_power);
847847 };
848- detail::copy (std::begin (prefix), std::end (prefix), out);
848+ out = detail::copy (std::begin (prefix), std::end (prefix), out);
849849 print_unit (U{});
850850 for_each (std::tuple<Rest...>{}, [&]<Unit Arg>(Arg) {
851- detail::copy (std::begin (separator), std::end (separator), out);
851+ out = detail::copy (std::begin (separator), std::end (separator), out);
852852 print_unit (Arg{});
853853 });
854854 *out++ = ' ]' ;
855855 return out;
856856}
857857
858858template <typename CharT, std::output_iterator<CharT> Out, typename F, int Num, int ... Den>
859- constexpr auto unit_symbol_impl (Out out, const power<F, Num, Den...>&, const unit_symbol_formatting& fmt,
860- bool negative_power)
859+ [[nodiscard]] constexpr auto unit_symbol_impl (Out out, const power<F, Num, Den...>&, const unit_symbol_formatting& fmt,
860+ bool negative_power)
861861{
862862 out = unit_symbol_impl<CharT>(out, F{}, fmt, false ); // negative power component will be added below if needed
863863 return copy_symbol_exponent<CharT, Num, Den...>(fmt.char_set , negative_power, out);
864864}
865865
866866template <typename CharT, std::output_iterator<CharT> Out, typename ... Us>
867- constexpr Out unit_symbol_impl (Out out, const type_list<>&, const unit_symbol_formatting&, bool )
867+ [[nodiscard]] constexpr Out unit_symbol_impl (Out out, const type_list<>&, const unit_symbol_formatting&, bool )
868868{
869869 return out;
870870}
871871
872872template <typename CharT, std::output_iterator<CharT> Out, typename U, typename ... Rest>
873- constexpr Out unit_symbol_impl (Out out, const type_list<U, Rest...>&, const unit_symbol_formatting& fmt,
874- bool negative_power)
873+ [[nodiscard]] constexpr Out unit_symbol_impl (Out out, const type_list<U, Rest...>&, const unit_symbol_formatting& fmt,
874+ bool negative_power)
875875{
876876 return ((out = unit_symbol_impl<CharT>(out, U{}, fmt, negative_power)), ...,
877- (print_separator<CharT>(out, fmt), out = unit_symbol_impl<CharT>(out, Rest{}, fmt, negative_power)));
877+ (out = print_separator<CharT>(out, fmt), out = unit_symbol_impl<CharT>(out, Rest{}, fmt, negative_power)));
878878}
879879
880880template <typename CharT, std::output_iterator<CharT> Out, typename ... Nums, typename ... Dens>
881- constexpr Out unit_symbol_impl (Out out, const type_list<Nums...>& nums, const type_list<Dens...>& dens,
882- const unit_symbol_formatting& fmt)
881+ [[nodiscard]] constexpr Out unit_symbol_impl (Out out, const type_list<Nums...>& nums, const type_list<Dens...>& dens,
882+ const unit_symbol_formatting& fmt)
883883{
884884 if constexpr (sizeof ...(Nums) == 0 && sizeof ...(Dens) == 0 ) {
885885 // dimensionless quantity
@@ -907,8 +907,8 @@ constexpr Out unit_symbol_impl(Out out, const type_list<Nums...>& nums, const ty
907907}
908908
909909template <typename CharT, std::output_iterator<CharT> Out, typename ... Expr>
910- constexpr Out unit_symbol_impl (Out out, const derived_unit_impl<Expr...>&, const unit_symbol_formatting& fmt ,
911- bool negative_power)
910+ [[nodiscard]] constexpr Out unit_symbol_impl (Out out, const derived_unit_impl<Expr...>&,
911+ const unit_symbol_formatting& fmt, bool negative_power)
912912{
913913 (void )negative_power;
914914 MP_UNITS_EXPECTS (negative_power == false );
0 commit comments