libstdc++@gcc.gnu.org.

Daniel Krügler daniel.kruegler@gmail.com
Sun Jan 26 06:46:30 GMT 2025


Am So., 26. Jan. 2025 um 03:50 Uhr schrieb Kok How Teh <
funcoolgeek@gmail.com>:

> vector<long> a = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
> assert(43589145600 == accumulate(a.begin(), a.end(), 1, multiplies()));
>
> That assertion fails! What do I miss?
>

I guess you need to replace the literal "1" (which is of type int) by the
literal "1L" within the assert expression. The value 43589145600 exceeds
std::numeric_limits<int>::max().

- Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20250126/2c637a24/attachment.htm>


More information about the Libstdc++ mailing list