Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extracting joule from watt multiplied by seconds #512

Open
magni-mar opened this issue Oct 26, 2023 · 4 comments
Open

extracting joule from watt multiplied by seconds #512

magni-mar opened this issue Oct 26, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@magni-mar
Copy link

magni-mar commented Oct 26, 2023

Got this bug while developing and wondering weather this is possible using mp-units v2.

When multiplying watt and seconds I am not able to place it into a variable that is designated as joule, is there a way around this?

#include <mp-units/systems/si/units.h>
#include <mp-units/systems/cgs/cgs.h>

auto main(int argc, char *argv[]) -> int {

    using namespace mp_units;

    quantity<si::watt> motor_power{4000 * si::watt};
    quantity<cgs::second> mix_time{60 * cgs::second};
    quantity<si::joule> motor_energy{motor_power * mix_time};

    return EXIT_SUCCESS;
}

the code above produces the error:

error: no matching function for call to ‘mp_units::quantity<mp_units::si::joule()>::quantity(<brace-enclosed initializer list>)’
   10 |     quantity<si::joule> motor_energy{motor_power * mix_time};
      |                                                            ^
@mpusz mpusz added the bug Something isn't working label Oct 26, 2023
@mpusz
Copy link
Owner

mpusz commented Oct 26, 2023

Thanks for reporting this bug. I am now on an extended vacation, but I will try to fix it when I find some time.

@magni-mar
Copy link
Author

To be noted, using mp_units::si::seconds this works, but not using mp_units::cgs::second

@mpusz
Copy link
Owner

mpusz commented Dec 5, 2023

Yes, I know. I was able to reproduce it, and I know now what the problem is. I just did not have time to try to fix it, as I spent all of my recent time writing ISO proposals and refactoring quantity points. I promise I will come back to it when I have a bit more time. Again, sorry that it takes so long to resolve.

@magni-mar
Copy link
Author

No problem I just wanted to note this for outside observers because I just discovered that I was using 2 different systems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants