From 0a11ebacb71f42c45ec6c463f1dfe779f4f2f322 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Wed, 11 May 2022 20:21:44 +0200 Subject: [PATCH] chore(example): unused `example/literals/custom_systems.cpp` removed --- example/literals/custom_systems.cpp | 113 ---------------------------- 1 file changed, 113 deletions(-) delete mode 100644 example/literals/custom_systems.cpp diff --git a/example/literals/custom_systems.cpp b/example/literals/custom_systems.cpp deleted file mode 100644 index 403475e1..00000000 --- a/example/literals/custom_systems.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2018 Mateusz Pusz -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include -#include -#include -#include -#include -#include -#include - -using namespace units; - -namespace fps { - -struct foot : named_unit {}; -struct yard : named_scaled_unit {}; - -struct dim_length : base_dimension<"L", foot> {}; - -template U, Representation Rep = double> -using length = quantity; - -} // namespace fps - -namespace si { - -struct metre : named_unit {}; -struct kilometre : prefixed_unit {}; - -struct dim_length : base_dimension<"L", metre> {}; - -template U, Representation Rep = double> -using length = quantity; - -namespace fps { - -struct foot : named_scaled_unit {}; -struct yard : named_scaled_unit {}; - -struct dim_length : base_dimension<"L", foot> {}; - -template U, Representation Rep = double> -using length = quantity; - -} // namespace fps -} // namespace si - -void conversions() -{ - // constexpr auto fps_yard = fps::length(1.); - // std::cout << quantity_cast(fps_yard) << "\n"; - - constexpr auto si_fps_yard = si::fps::length(1.); - std::cout << quantity_cast(si_fps_yard) << "\n"; -} - -void unknown_dimensions() -{ - constexpr auto fps_yard = fps::length(1.); - constexpr auto fps_area = quantity_cast(fps_yard * fps_yard); - std::cout << fps_yard << "\n"; - std::cout << fps_area << "\n"; - - constexpr auto si_fps_yard = si::fps::length(1.); - constexpr auto si_fps_area = quantity_cast(si_fps_yard * si_fps_yard); - std::cout << si_fps_yard << "\n"; - std::cout << si_fps_area << "\n"; -} - -std::ostream& operator<<(std::ostream& os, const ratio& r) -{ - return os << "ratio{" << r.num << ", " << r.den << ", " << r.exp << "}"; -} - -template -std::ostream& operator<<(std::ostream& os, const U& u) -{ - using unit_type = std::remove_cvref_t; - return os << unit_type::ratio << " x " << unit_type::reference::symbol.standard(); -} - -void what_is_your_ratio() -{ - std::cout << "fps: " << fps::yard() << "\n"; - std::cout << "si::fps: " << si::fps::yard() << "\n"; -} - -int main() -{ - conversions(); - unknown_dimensions(); - what_is_your_ratio(); -}