Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2002-10-13 11:19:17

Daniel Frey <daniel.frey_at_[hidden]> writes:

| Gabriel Dos Reis wrote:
| >
| > Daniel Frey <daniel.frey_at_[hidden]> writes:
| >
| > | It's not really unsafety, but it limits you in development,
| >
| > Really? Right now, it doesn't.
| Exactly :)) Right now, it doesn't. But it will limit you in the future,

How can you know that will me limit me? Answer: You can't :-)
You showed a hypothetical example, but I don't see any concrete
situation where that modification would make sense for the project at

| when you need to optimize the code - which is typically done during a
| very busy period when the customer is testing the product's release
| candidate for the first time and it is too slow.

When optimizing code, I use a profiler that tells me the hot spot.
And I can't see any situation where your hypothetical example would be
any optmization or improvement.

| If you can change a
| function from returning a reference instead of a copy, it can be a good
| optimization, but it's very ugly if you have to change code which relies
| on the function to return a real (modifiable) object. This may not be
| relevant in projects with 10.000 lines of code, but the bigger the
| project, the bigger you problem will be.

We're specifically talking of *iterators* I've yet to see an
implementation of an iterator where your example would be any

| > Well, I would say it is that change that may be a limit since I expect
| > an iterator to be an _object_ -- from all the various definitions I've
| > worked with, iterators were values.
| Ask yourself: What is a "value"?

I already did before writing the above :-)

| To me, it is something that I can read.

Interesting. So you can read a reference. How?

| It's different from an "object", which is something you can change.

Is that to mean that something you can't change isn't an object? If
no, how the above statement is any helpful in distinguishing
references from objects?

| You expect the function to return a value?

No. I except a function to return (i) nothing, (ii) a value or (iii) a

-- Gaby

Boost list run by bdawes at, gregod at, cpdaniel at, john at