forked from mpusz/mp-units
Velocity renamed to Speed (resolves #103)
This commit is contained in:
@@ -20,13 +20,13 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/physical/si/velocity.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
|
||||
template<units::physical::Length D, units::physical::Time T>
|
||||
constexpr units::physical::Velocity AUTO avg_speed(D d, T t)
|
||||
constexpr units::physical::Speed AUTO avg_speed(D d, T t)
|
||||
{
|
||||
return d / t;
|
||||
}
|
||||
@@ -38,10 +38,10 @@ void example()
|
||||
|
||||
Length AUTO d1 = 123q_m;
|
||||
Time AUTO t1 = 10q_s;
|
||||
Velocity AUTO v1 = avg_speed(d1, t1);
|
||||
Speed AUTO v1 = avg_speed(d1, t1);
|
||||
|
||||
auto temp1 = v1 * 50q_m; // produces intermediate unknown dimension with 'unknown_coherent_unit' as its 'coherent_unit'
|
||||
Velocity AUTO v2 = temp1 / 100q_m; // back to known dimensions again
|
||||
Speed AUTO v2 = temp1 / 100q_m; // back to known dimensions again
|
||||
Length AUTO d2 = v2 * 60q_s;
|
||||
|
||||
std::cout << "d1 = " << d1 << '\n';
|
||||
|
||||
Reference in New Issue
Block a user