Mess about with const-ref C++ functions but not really get anywhere.