R
Richard Cavell
#include <stdint.h>
class uint128bit
{
public:
uint64_t bits0to63;
uint64_t bits64to127;
uint128bit operator= (uint128bit op2) { bits0to63 = op2.bits0to63;
bits64to127 = op2.bits64to127; return *this; }
uint128bit operator= (uint64_t op2) { bits0to63 = op2; bits64to127 =
0; return *this; }
};
int main (int argc, char * const argv[]) {
uint64_t a = 1LL;
uint128bit i128_a = a;
return 0;
}
This last line of code fails, saying: conversion from 'uint64_t' to
non-scalar type 'uint128bit' requested. What have I done wrong?
class uint128bit
{
public:
uint64_t bits0to63;
uint64_t bits64to127;
uint128bit operator= (uint128bit op2) { bits0to63 = op2.bits0to63;
bits64to127 = op2.bits64to127; return *this; }
uint128bit operator= (uint64_t op2) { bits0to63 = op2; bits64to127 =
0; return *this; }
};
int main (int argc, char * const argv[]) {
uint64_t a = 1LL;
uint128bit i128_a = a;
return 0;
}
This last line of code fails, saying: conversion from 'uint64_t' to
non-scalar type 'uint128bit' requested. What have I done wrong?