Open NAThompson opened 4 years ago
Sir, according to this answer given in stackoverflow and by the rules of aggregate initialization, explicit constructors are not considered for initializing member objects. So, for initializing with strings we may need a helper function as given in the answer.
Yeh that sucks, but I think that constructor really should be explicit on the whole. So that means each string has to be cast to a cpp_bin_float_oct I'm afraid.
Longer term, now that we're starting to get better constexpr support, it might be good to support user-defined literals for cpp_bin_float.
Sir, but can't we have a simple template function which takes this values and converts it to given number type to be initialized in the std::array.
but can't we have a simple template function which takes this values and converts it to given number type to be initialized in the std::array.
We have one already - it's the explicit constructor, I don't see that:
make_cpp_bin_float_oct("1234")
Is better than:
cpp_bin_float_oct("1234");
No sir, something like mentioned in this answer: https://stackoverflow.com/questions/48742738/initializing-array-through-explicit-constructor. It will make initializing array's easier.
No sir, something like mentioned in this answer: https://stackoverflow.com/questions/48742738/initializing-array-through-explicit-constructor. It will make initializing array's easier.
That's actually a pretty cunning solution - I like it!
Sir, can I start working on adding this to the library?
In the following code:
There is no problem initializing
b
, but initializinga
causes a problem:What is the best way to initialize a
std::array
with multiprecision types?