extern

is there a way to set the external reference as constant while leaving the file that has permission to modify it as non constant or will I just have to use slower function calls.
1
2
3
// file.h

extern const int& reference_to_const_int ;


1
2
3
4
5
6
7
8
9
10
// file.cc

#include "file.h"

namespace
{
    int modifiable_lvalue = 100 ;
}

const int& reference_to_const_int = modifiable_lvalue ;


Thanx
Topic archived. No new replies allowed.