| rvalues/rval-1.cc - The rvalue example - in a bit of context. | Lecture 2 - slide 11 : 29 Program 1 |
#include <iostream>
#include <string>
#include "point.h"
double f(int i, double d){return i + d;}
int main(){
double e = 3.14;
double d = f(5, e);
int i = 5, k = i + 8;
bool b = Point{1,2} == Point{3,4};
double *pe = &3.14; // error: Cannot take the address of a 3.14
double *pd = &f(5, e); // error: Cannot take the address of a f(5, e)
int *pi = &(i + 8); // error: Cannot take the address of (i + 8)
}