c++ built in type overload operator=

Started by
2 comments, last by wintertime 10 years, 6 months ago

Im working with gcc's built in type int128_t gcc doesnt work with integer constants that large so im trying to make them with strings. Whe I try to overload operator= I get "must be a nonstatic member function" it seems like it has to be part of the class but being that the int128_t is part of gcc I dont want to mess with it directly is there another way besides making it a different function I would like to be able to use the = operator

Advertisement

If you're using a version of gcc that supports C++11 then you might want to consider using user defined literals rather than trying to modify operator=.

Unfortunately c++11 isnt available on all the platforms this project is for so im left with little choices

I didn't try, but should'nt you be able to do it like this?


static const int128_t whatever=(int128_t(0xfedcba9876543210LL)<<64)+0x0123456789abcdefLL;

This topic is closed to new replies.

Advertisement