473,771 Members | 2,347 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The "smart guarantee"?

I wanted to post this proposal on c.l.c++.m, but my news
server apparently does not support that group any more.

I propose a new class of exception safety known as the
"smart guarantee". Essentially, the smart guarantee
promises to clean up resources whose ownership is
passed into the function, for whatever defintion of "clean
up" is most appropriate for the resource passed.
Note that this is different from both the basic and the
strong guarantee.

According to David Abrahams, (here:
http://www.boost.org/more/generic_exception_safety.html)
the common guarantees are as follows:

The basic guarantee: that the invariants of the
component are preserved, and no resources
are leaked.
The strong guarantee: that the operation has either
completed successfully or thrown an exception,
leaving the program state exactly as it was before
the operation started.
The no-throw guarantee: that the operation will not
throw an exception.

Now, one could be pedantic and say that the strong
guarantee doesn't really promise that the program state
will be "exactly" as it was before the operation started,
since there is now an exception object present in the
state which was not present before (if an exception is
thrown, of course). However, let us not dwell on that
pedantry, but a different one: what if the "operation" is
a function which receives ownership of a resource,
like so:

void foo(obj* p);

foo(new obj);

Now, before the function is called, a new object is
created on the heap. However, the only reference
to that object is bound to a parameter of foo(). So
technically, foo() is free to allow the last (and only)
reference to obj go out of scope, and still provide
the strong guarantee. If an exception is thrown, foo()
exits, and the object is still on the heap; hence, the
program state is preserved. Thus, foo() can be
strongly exception safe and leak a resource.

Clearly, most implementors of foo() will try to properly
dispose of p in the event of an exception. But now
foo() doesn't offer the strong guarantee, because if
an exception is thrown, the exit state will be different
from the entry state. However, such an implementation
of foo() still offers some measure of safety in the face
of exceptions, and foo() may provide the strong
guarantee for all of the state not including the
resources whose ownership was transferred into the
function.

I propose to call this level of safety the "smart
guarantee". It may seem like an obscure corner
case which does not deserve a name of its own,
because functions which take sole ownership of a
resource are not so common. I argue that if the
language receives fundamental support for move
semantics, then such functions may, in fact, become
more common; and thus this level of exception
safety may become more relevant.

I chose the name "smart" because that seems to
connote an awareness of resources or some type
of automatic management. Note that the smart
guarantee is somewhat orthogonal to the basic and
strong guarantee. So a function could provide the
basic guarantee for local state, and the smart
guarantee for ownership-transfer arguments.
Or, it could offer the strong guarantee for all
ownership-stable state, and the smart guarantee
for ownership-transfer state. It is perhaps useful to
call these situations the "smart basic guarantee"
and the "smart strong guarantee", respectively.
I think of the "smart guarantee" as the "smart
strong guarantee" by default.

To explicitly state that an operation does not
provide the smart guarantee, but does provide
one of the other guarantees, I would say that it
provides the "simple basic" or "simple strong"
guarantee. By default, "basic guarantee" and
"strong guarantee" should mean the simple
versions.

Comments are welcome.

Dave

Jul 19 '05
14 2685
"Rob Williscroft" <rt*@freenet.RE MOVE.co.uk> wrote in message
news:Xn******** *************** ***********@195 .129.110.130...
[...]
Its the bit were you say "(by deleting your object)", Where
I just don't see it that way, once the paramiter has been
succesfully passed it belong's to the state of the function
or ctor.
Well, David Abrahams doesn't see it that way, and he
wrote the exception safety definitions you quote below.
[...]
Note that both client_reponsib le() and its_a_contract( )
can be adapted to a server() taking multiple resources
Just like you can build your own strong guarantee, but
it's still nice when a component provides it for you. In
some extreme cases, you can't build your own strong
guarantee (such as for non-copyable objects), but it
seems unlikely that there are any cases where you
couldn't build your own "smart guarantee".
but:

void wont_work()
{
server( new obj, new obj );
}

can't. If either of the new obj expressions throw's the the
other leaks.
Which is why this is a bad thing to do in general, and I've
never encountered a situation where I even *wanted* to
do this.
Which all means that whatever function or ctor we are
talking about that offers the Smart Guarantee is also a
resource initializer, wether we call it that or not.
I'm not sure what you mean by "resource initializer", but
consider a function like some_smart_poin ter::reset(T* p).
Is that still "resource initialization" ?
From: http://www.boost.org/more/generic_exception_safety.html
If you notice, I quoted this in my original post. You could
have just quoted my quote. ;)
<quote>
The basic guarantee: that the invariants of the component are
preserved, and no resources are leaked.
</quote>

I think that covers a RAII initializer. Though perhaps if it
isn't obvious (i.e. smart_ptr<> is obviously RAII) that RAII
symantics apply, we should document that the function/ctor
is a RAII initializer.


The basic guarantee is a necessary but not sufficient
condition of the smart guarantee. The point of the smart
guarantee is to go beyond preserving invariants, and say
that just about all of the state is actually preserved. After
all, preserving invariants isn't nearly as useful as
preserving state.

Dave


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.m oderated. First time posters: Do this! ]
Jul 19 '05 #11
"David B. Held" <dh***@codelogi cconsulting.com > wrote in message news:<bj******* ***@news.astoun d.net>...
"David Abrahams" <da**@boost-consulting.com> wrote in message
news:ul******** ***@boost-consulting.com. ..
"David B. Held" <dh***@codelogi cconsulting.com > writes:
[...]
That is really the key question. There's not actually a
"ladder" of exception safety distinctions: it's a lattice.
The set of all possible exception safety rules is a lattice,
but the "known" rules form a non-decreasing hierarchy
of state integrity. The basic guarantee only promises that
in the event of an exception, state will be valid. The smart
guarantee says that state will be known, and most of it
will be unchanged.


That isn't the way you characterized it before. Maybe you need to
nail down the definition.
The strong and nothrow guarantee say that all state will be unchanged.
Actually the nothrow guarantee says there will be no exception, so you
can draw any conclusion you like about what would happen if an
exception were to occur ;-)
For example, you could imagine a similar guarantee
which says that *this might change if an exception is
thrown, but none of the arguments will be modified
(in addition to the basic guarantee of course).


Yes, but can you cite one non-contrived instance in which
this guarantee offers something useful?


Not offhand. I think that's my point; I'm offering you the same
challenge.
But you've put your finger on it: is your guarantee really
useful? I chose to name the particular distinctions I did
because they *were* useful for reasoning about
program correctness. How would you use your
guarantee in program design?


Let's use your example, but tweak it a bit. Instead of using
std::set, let's say we have a set container that uses pointer semantics, and
that it takes ownership of the objects put
into it. Furthermore, ptr_set::insert () gives the smart
guarantee:

template <class T>
class SearchableStack
{
public:
void push(T* t); // O(log n)
void pop(); // O(log n)
bool contains(T* t) const; // O(log n)
T* top() const; // O(1)
private:
ptr_set<T> set_impl;
std::list<ptr_s etset<T>::itera tor> list_impl;
};

/* 01 */ template <class T>
/* 02 */ void SearchableStack <T>::push(T* t)
/* 03 */ {
/* 04 */ ptr_set<T>::ite rator i = set_impl.insert (t);
/* 05 */ try
/* 06 */ {
/* 07 */ list_impl.push_ back(i);
/* 08 */ }
/* 09 */ catch(...)
/* 10 */ {
/* 11 */ set_impl.erase( i);
/* 12 */ throw;
/* 13 */ }
/* 14 */ }

The analysis would be the same as with your example
except for line 4. Not only do we want ptr_set::insert ()
to not change the set if it fails, we also want it to clean
up t as well, so we can write code like so:

SearchableStack <obj> s;
s.push(new obj);


Ah, OK. But then if you want this guarantee to be useful, *this can't
be special at all; there might be other persistent arguments which you
want to say haven't changed either. I think you just want to have a
way of labelling certain program state as changeable in case of an
exception. For this to be useful, you need to be explicit about which
state is changeable; it isn't enough to say "it offers the ``smart
guarantee''".

By the way, I think "smart guarantee" is a terrible name for this
idea. There's nothing dumb about it, but also nothing particularly
smart about it (as compared with the other guarantees).
because it is analogous to the strong guarantee
while not being the strong guarantee.


That, in itself, does *not* make it useful. The guarantee
I invented above can make the same claims about
being similar to the strong guarantee yet I've never
heard of anyone using or wanting it. I could come up
with any number of others.


Yes, but your example is not similar to the strong
guarantee in a useful way. My point is that the smart
guarantee is similar to the strong guarantee for all of
the state that you *wish* to be preserved, and only
violates transaction semantics to fulfill the constraint
that no resources are leaked. Since one does not need
to modify *this to prevent resource leakage, such a
property would not seem desirable.
In fact, why should *this be special? It's an argument
like all the others, except that it's "hidden".


I don't think *this is particularly special. What *is* special
is resources being bound to a function parameter with
no other references. That is the case that merits special
attention, IMO.


But that's a feature of the caller, not of the callee!

SearchableStack s;
T* p = new T;
s.push(p);
p->whatever();

If you want to make it into a feature of the callee, pass a
std::auto_ptr by value. Then you know that nobody outside the caller
can legally use the pointer after the call, because the interface
enforces it. Since function arguments never survive a call and the
resource is wholly owned by the auto_ptr you can just say the function
gives the strong guarantee; end-of-story.
[...]
Anything *could* be useful, but the proof is in the
pudding. Distinctions are useful in proportion to their
starkness. If we labelled every point in the spectrum
we would have a wide array of terms, but I claim it
would leave us less powerful to identify program
behaviors, not more.


True enough. And like I said before, ownership transfer
may be rare enough that this distinction is not that
useful. I can't list a bunch of use cases where the
smart guarantee is an important part of exception safety
analysis.


That's my point.
But I think it does address what seems to be
a flaw, or at least, a peculiarity, of the strong guarantee,
without inventing new exception guidelines arbitrarily.


It's neither a flaw nor a peculiarity of the strong guarantee, IMO.
It covers the case perfectly when you use std::auto_ptr, and isn't
designed to cover the case otherwise. I don't believe the few authors
of smart pointers need a whole new distinction named for what they do
in their constructors in order to make the theory complete -- they can
just spell out the semantics directly. Furthermore, in an ideal world
(when we get template varargs or at least the forwarding problem
solved) nobody will write new-expressions directly anyway. Instead
we'll use factory functions like:

std::auto_ptr<T >::new_(arg1, arg2, arg3)

which are equivalent to:

std::auto_ptr<T >(new T(arg1,arg2,arg 3))

My 33 cents,
Dave
Jul 19 '05 #12
"David Abrahams" <da************ @rcn.com> wrote in message
news:ea******** *************** ***@posting.goo gle.com...
[...]
That isn't the way you characterized it before.
I'm pretty sure it is, but I don't think it's worth the time to review.
[Me]
Yes, but can you cite one non-contrived instance in which
this guarantee offers something useful?


Not offhand. I think that's my point; I'm offering you the
same challenge.


I offered some examples. I suppose you think containers
with pointer semantics are "contrived" , though, huh?
[...]
Ah, OK. But then if you want this guarantee to be useful,
*this can't be special at all;
I'm not sure where you got the idea that I said *this should
be handled specially.
there might be other persistent arguments which you
want to say haven't changed either. I think you just want
to have a way of labelling certain program state as
changeable in case of an exception.
Yes.
For this to be useful, you need to be explicit about which
state is changeable; it isn't enough to say "it offers the
``smart guarantee''".
Actually, I *was* explicit about which state is changeable.
The state that is changeable is dynamic resources whose
ownership is irreversibly transferred into the function. That
turns out to be the only state which you would *want* to
change in order to have a good safety guarantee.
By the way, I think "smart guarantee" is a terrible name
for this idea. There's nothing dumb about it, but also
nothing particularly smart about it (as compared with the
other guarantees).
Actually, there is. It promises to give you the strong
guarantee except that it will do one smart thing and
automatically clean up resources. In the sense that "smart"
is used in other contexts to imply automatic management,
especially of resources, I think it is quite reasonable.
[...]
SearchableStack s;
T* p = new T;
s.push(p);
p->whatever();

If you want to make it into a feature of the callee, pass a
std::auto_ptr by value.
But if s were an auto_ptr<>, what would you do?

T* p = new T;
auto_ptr<T> s(p);

Why allow the inline new call in one context, but not another?
Then you know that nobody outside the caller can legally
use the pointer after the call, because the interface
enforces it. Since function arguments never survive a call
and the resource is wholly owned by the auto_ptr you can
just say the function gives the strong guarantee; end-of-
story.
Yes. But this is a case of externally giving a stronger
guarantee, which is just like externally giving a function
the strong guarantee by copying the modifiable state first.
So then your argument is that no component should give
the strong guarantee because a client can always provide
it herself? If a function can provide the strong guarantee
efficiently, isn't it better if it does so?
[...]
But I think it does address what seems to be
a flaw, or at least, a peculiarity, of the strong
guarantee, without inventing new exception
guidelines arbitrarily.
It's neither a flaw nor a peculiarity of the strong
guarantee, IMO. It covers the case perfectly when you
use std::auto_ptr, and isn't designed to cover the case
otherwise.


But then, we don't need to have the strong guarantee,
since we can almost always provide it ourselves.
I don't believe the few authors of smart pointers need a
whole new distinction named for what they do in their
constructors
Don't forget reset(). ;>
in order to make the theory complete -- they can just
spell out the semantics directly.
Ok, you caught me. ;) I was hoping that containers with
pointer semantics would provide another justification,
but they probably wouldn't add considerably to the
number of users who want the smart guarantee.
Furthermore, in an ideal world (when we get template
varargs or at least the forwarding problem solved)
nobody will write new-expressions directly anyway.
Instead we'll use factory functions like:

std::auto_ptr<T >::new_(arg1, arg2, arg3)

which are equivalent to:

std::auto_ptr<T >(new T(arg1,arg2,arg 3))


That would certainly be nice.

Dave

Jul 19 '05 #13

"David B. Held" <dh***@codelogi cconsulting.com > wrote in message
news:<bj******* ***@news.astoun d.net>...
"David Abrahams" <da**@boost-consulting.com> wrote in message
news:ul******** ***@boost-consulting.com. ..
"David B. Held" <dh***@codelogi cconsulting.com > writes:
[...]
That is really the key question. There's not actually a
"ladder" of exception safety distinctions: it's a lattice.
The set of all possible exception safety rules is a lattice,
but the "known" rules form a non-decreasing hierarchy
of state integrity. The basic guarantee only promises that
in the event of an exception, state will be valid. The smart
guarantee says that state will be known, and most of it
will be unchanged.


That isn't the way you characterized it before. Maybe you need to
nail down the definition.
The strong and nothrow guarantee say that all state will be unchanged.
Actually the nothrow guarantee says there will be no exception, so you
can draw any conclusion you like about what would happen if an
exception were to occur ;-)
For example, you could imagine a similar guarantee
which says that *this might change if an exception is
thrown, but none of the arguments will be modified
(in addition to the basic guarantee of course).


Yes, but can you cite one non-contrived instance in which
this guarantee offers something useful?


Not offhand. I think that's my point; I'm offering you the same
challenge.
But you've put your finger on it: is your guarantee really
useful? I chose to name the particular distinctions I did
because they *were* useful for reasoning about
program correctness. How would you use your
guarantee in program design?


Let's use your example, but tweak it a bit. Instead of using
std::set, let's say we have a set container that uses pointer semantics, and
that it takes ownership of the objects put
into it. Furthermore, ptr_set::insert () gives the smart
guarantee:

template <class T>
class SearchableStack
{
public:
void push(T* t); // O(log n)
void pop(); // O(log n)
bool contains(T* t) const; // O(log n)
T* top() const; // O(1)
private:
ptr_set<T> set_impl;
std::list<ptr_s etset<T>::itera tor> list_impl;
};

/* 01 */ template <class T>
/* 02 */ void SearchableStack <T>::push(T* t)
/* 03 */ {
/* 04 */ ptr_set<T>::ite rator i = set_impl.insert (t);
/* 05 */ try
/* 06 */ {
/* 07 */ list_impl.push_ back(i);
/* 08 */ }
/* 09 */ catch(...)
/* 10 */ {
/* 11 */ set_impl.erase( i);
/* 12 */ throw;
/* 13 */ }
/* 14 */ }

The analysis would be the same as with your example
except for line 4. Not only do we want ptr_set::insert ()
to not change the set if it fails, we also want it to clean
up t as well, so we can write code like so:

SearchableStack <obj> s;
s.push(new obj);


Ah, OK. But then if you want this guarantee to be useful, *this can't
be special at all; there might be other persistent arguments which you
want to say haven't changed either. I think you just want to have a
way of labelling certain program state as changeable in case of an
exception. For this to be useful, you need to be explicit about which
state is changeable; it isn't enough to say "it offers the ``smart
guarantee''".

By the way, I think "smart guarantee" is a terrible name for this
idea. There's nothing dumb about it, but also nothing particularly
smart about it (as compared with the other guarantees).
because it is analogous to the strong guarantee
while not being the strong guarantee.


That, in itself, does *not* make it useful. The guarantee
I invented above can make the same claims about
being similar to the strong guarantee yet I've never
heard of anyone using or wanting it. I could come up
with any number of others.


Yes, but your example is not similar to the strong
guarantee in a useful way. My point is that the smart
guarantee is similar to the strong guarantee for all of
the state that you *wish* to be preserved, and only
violates transaction semantics to fulfill the constraint
that no resources are leaked. Since one does not need
to modify *this to prevent resource leakage, such a
property would not seem desirable.
In fact, why should *this be special? It's an argument
like all the others, except that it's "hidden".


I don't think *this is particularly special. What *is* special
is resources being bound to a function parameter with
no other references. That is the case that merits special
attention, IMO.


But that's a feature of the caller, not of the callee!

SearchableStack s;
T* p = new T;
s.push(p);
p->whatever();

If you want to make it into a feature of the callee, pass a
std::auto_ptr by value. Then you know that nobody outside the caller
can legally use the pointer after the call, because the interface
enforces it. Since function arguments never survive a call and the
resource is wholly owned by the auto_ptr you can just say the function
gives the strong guarantee; end-of-story.
[...]
Anything *could* be useful, but the proof is in the
pudding. Distinctions are useful in proportion to their
starkness. If we labelled every point in the spectrum
we would have a wide array of terms, but I claim it
would leave us less powerful to identify program
behaviors, not more.


True enough. And like I said before, ownership transfer
may be rare enough that this distinction is not that
useful. I can't list a bunch of use cases where the
smart guarantee is an important part of exception safety
analysis.


That's my point.
But I think it does address what seems to be
a flaw, or at least, a peculiarity, of the strong guarantee,
without inventing new exception guidelines arbitrarily.


It's neither a flaw nor a peculiarity of the strong guarantee, IMO.
It covers the case perfectly when you use std::auto_ptr, and isn't
designed to cover the case otherwise. I don't believe the few authors
of smart pointers need a whole new distinction named for what they do
in their constructors in order to make the theory complete -- they can
just spell out the semantics directly. Furthermore, in an ideal world
(when we get template varargs or at least the forwarding problem
solved) nobody will write new-expressions directly anyway. Instead
we'll use factory functions like:

std::auto_ptr<T >::new_(arg1, arg2, arg3)

which are equivalent to:

std::auto_ptr<T >(new T(arg1,arg2,arg 3))

My 33 cents,
Dave

--
Dave Abrahams
Boost Consulting
www.boost-consulting.com

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.m oderated. First time posters: Do this! ]
Jul 19 '05 #14
"David B. Held" <dh***@codelogi cconsulting.com > wrote in message news:<bj******* ***@news.astoun d.net>...
"David Abrahams" <da************ @rcn.com> wrote in message
news:ea******** *************** ***@posting.goo gle.com...
Yes, but can you cite one non-contrived instance in which
this guarantee offers something useful?
Not offhand. I think that's my point; I'm offering you the
same challenge.


I offered some examples. I suppose you think containers
with pointer semantics are "contrived" , though, huh?


No. I do think that one shouldn't pass raw pointers to unmanaged
resources across their interface boundaries, though (or any interface
boundaries, for that matter). This is especially true because it
doesn't scale beyond one unmanaged resource parameter.
[...]
Ah, OK. But then if you want this guarantee to be useful,
*this can't be special at all;


I'm not sure where you got the idea that I said *this should
be handled specially.


It was your use of the word "external" in:

I contend that this level of safety is useful to identify,
because it is analogous to the strong guarantee
while not being the strong guarantee. You know
that foo's state is preserved, even if the external
state is not, and that can be a useful piece of
information in analyzing foo's behaviour in the
presence of exceptions.
there might be other persistent arguments which you
want to say haven't changed either. I think you just want
to have a way of labelling certain program state as
changeable in case of an exception.


Yes.
For this to be useful, you need to be explicit about which
state is changeable; it isn't enough to say "it offers the
``smart guarantee''".


Actually, I *was* explicit about which state is changeable.
The state that is changeable is dynamic resources whose
ownership is irreversibly transferred into the function.


Please, Dave: you didn't say that before. If you're saying that now,
fine. If you think I should've inferred it from what you said
earlier, please keep in mind that when you're talking about the EH
guarantees you're in the context of program specification and both
precision and explicitness count.

Try to think about how you'd write a precise description of your
guarantee, keeping in mind that transfer-of-ownership is a slippery
idea to nail down in specification. IMO the best way to deal with
situations like this one is to enforce the transfer-of-ownership in
the interface. Use auto_ptr if you can, or if you absolutely *must*
pass raw pointers, use a kind of smart pointer with implicit
conversion from T*. IMO the second-best way is to add to the
documentation "if an exception is thrown, p will be deleted". The
second-best way can be difficult when dealing with anything other than
constructors, though: _when_ will p be deleted? That's why it's only
second-best.
That turns out to be the only state which you would *want* to
change in order to have a good safety guarantee.
Sure, for some broad definition of "resource" (another slippery
notion).
By the way, I think "smart guarantee" is a terrible name
for this idea. There's nothing dumb about it, but also
nothing particularly smart about it (as compared with the
other guarantees).


Actually, there is. It promises to give you the strong
guarantee except that it will do one smart thing and
automatically clean up resources. In the sense that "smart"
is used in other contexts to imply automatic management,
especially of resources, I think it is quite reasonable.


It's not a complete idea without the notion of which unmanaged
resources are being transferred.

<context you snipped>
I don't think *this is particularly special. What *is* special
is resources being bound to a function parameter with
no other references. That is the case that merits special
attention, IMO.
But that's a feature of the caller, not of the callee! </context you snipped>
[...]
SearchableStack s;
T* p = new T;
s.push(p);
p->whatever();

If you want to make it into a feature of the callee, pass a
std::auto_ptr by value.


But if s were an auto_ptr<>, what would you do?

T* p = new T;
auto_ptr<T> s(p);

Why allow the inline new call in one context, but not another?


To limit the scope of danger.
Then you know that nobody outside the caller can legally
use the pointer after the call, because the interface
enforces it. Since function arguments never survive a call
and the resource is wholly owned by the auto_ptr you can
just say the function gives the strong guarantee; end-of-
story.


Yes. But this is a case of externally giving a stronger
guarantee, which is just like externally giving a function
the strong guarantee by copying the modifiable state first.


No, it's the opposite. The guarantee is ensured *internally* to the
function, by its interface.
So then your argument is that no component should give
the strong guarantee because a client can always provide
it herself?
Huh?? How did you arrive at that conclusion?
If a function can provide the strong guarantee
efficiently, isn't it better if it does so?


Generally, but I don't see how that relates to the issue at hand.
[...]
But I think it does address what seems to be
a flaw, or at least, a peculiarity, of the strong
guarantee, without inventing new exception
guidelines arbitrarily.


It's neither a flaw nor a peculiarity of the strong
guarantee, IMO. It covers the case perfectly when you
use std::auto_ptr, and isn't designed to cover the case
otherwise.


But then, we don't need to have the strong guarantee,
since we can almost always provide it ourselves.


Your line of argument, if you'll excuse me for saying so, is pure
nuttiness. If std::vector::pu sh_back didn't provide the strong
guarantee, how would you propose we can "provide it ourselves"?
I don't believe the few authors of smart pointers need a
whole new distinction named for what they do in their
constructors


Don't forget reset(). ;>


Personally I think having reset() at all is a design mistake. Show me
a reset() which can throw and I'll show you an even worse design
mistake.
in order to make the theory complete -- they can just
spell out the semantics directly.


Ok, you caught me. ;) I was hoping that containers with
pointer semantics would provide another justification,
but they probably wouldn't add considerably to the
number of users who want the smart guarantee.


Especially not if properly designed. Consider how the range inserter
that takes three iterators should work on a deque with pointer
semantics. There's no way to track resource management if you pass a
range of raw pointers.
Jul 19 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
12324
by: Martin Goldman | last post by:
Hello all, I've been struggling for a few days with the question of how to convert "smart" (curly) quotes into straight quotes. I tried playing with the htmlentities() function, but all that is doing is changing the smart quotes into nonsense characters. I also searched the web for quite a while and was unsuccessful in finding a solution. What puzzles me is that doing it the other way around is simple enough. For example, this works...
2
4271
by: Tim Hochberg | last post by:
During the recent, massive, painful Lisp-Python crossposting thread the evils of Python's whitespace based indentation were once again brought to light. Since Python' syntax is so incredibly brittle, and failure prone, it's amazing that we don't have more editor support for our feeble minds. To help reduce the severity of this crisis, I decided to take a whack at creating smart block copy and paste functionality. Anyway, I wrote some...
11
7045
by: Ron | last post by:
Hello, I'm having an aggravating time getting the "html" spewed by Word 2003 to display correctly in a webpage. The situation here is that the people creating the documents only know Word, and aren't very computer savvy. I created a system where they can save their Word documents as "html" and upload them to a certain directory, and the web page dynamically runs them through tidylib using the tidy extension to php4, thus causing the...
14
1842
by: Capstar | last post by:
Hi NG, I am developing a piece of software, which contains basicly one loop, which consinsts of 2 parts. Thos two parts are again basicly the same, but they deiffer in some variables. So I changed the variables from foo0 and foo1 to foo, so I can index them. This way I can run through the loop two times more, but switch the index between 0 and 1. This is pretty easy. I did it this way: int idx;
2
2379
by: BobAchgill | last post by:
Is there a way to let the User click on a button on a web site and have that download and install my prepackaged compressed data directory and place it nicely under my existing VB .Net Form application on the User's computer? Maybe another way of asking the question is. Can I build a smart .msi "data" installer that will when clicked on as "Run" on the web page will load into the desktop's memory ... find the location of my VB .Net Form...
5
2899
by: Noozer | last post by:
I'm looking for a "smart folder" program to run on my Windows XP machine. I'm not having any luck finding it and think the logic behind the program is pretty simple, but I'm not sure how I'd implement this. I've done some VB6 programming and dabbled in VS.Net. Can someone share some pointers in how I could implement the following? Basically, you drag a file to the "smart" folder and, depending on the type of file and settings for that...
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.