Hossein Haeri | 1 May 13:32 2003
Picon

Re: Re: const shared_ptr<>

Dear John,

> I'd say you could call any of the 'const' member
> functions (e.g. 
> operator*(), operator->(), get(),...,etc), but the
> returned type is a 
> non-const pointer.
> 
> Since operator*() is a const member function, it is
> legal on a const 
> shared_ptr<T>.  The '=', then, applies to the
> non-const shared ptr 
> returned, not to the shared_ptr<T> object, itself.

I can't understand! Can you please describe your idea
more? Do you mean that calling a non-const member 
function for shared_ptr<T> will result in acting the
desired operatio on a temporal mutable copy of the 
original const version?

> Note also, that you're supposed to initialized
> shared_ptr<T> with a 
> *dynamically* allocated T (use new), because it will
> call 'delete' on 
> the ptr when the last reference disappears.  So you
> are wrong to 
> initialize it with the address of a stack variable.

Thank you very much because of recalling that to me.
But a subtle point here is that the asserion you made
(Continue reading)

Simon Brown | 1 May 13:52 2003
A few days ago I received great help with a regexp question - now here's
another which I doubt can be done.

Question: if the text string contains three words AAA BBB AAA then return
the string (if any) which is repeated two or three times.

Examples:
AAA AAA AAA return AAA
AAA BBB AAA return AAA
AAA AAA BBB return AAA
AAA BBB CCC return <nothing>

Can this be done with a regular expression?

And a very, very big thanks to those who wrote regexp, you have no idea how
useful it is for me :-)

Simon Brown, Casa Bergenia, CH-7031 Laax
www.hb9drv.ch

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading!
Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/cjB9SD/od7FAA/uetFAA/EbFolB/TM
---------------------------------------------------------------------~->

Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe <at> yahoogroups.com>

(Continue reading)

Hossein Haeri | 1 May 13:57 2003
Picon

Re: Re: const shared_ptr<> oops

Dear John,

I have done a mistake in the answer to your following
assertion:

> Note also, that you're supposed to initialized
> shared_ptr<T> with a 
> *dynamically* allocated T (use new), because it will
> call 'delete' on 
> the ptr when the last reference disappears.  So you
> are wrong to 
> initialize it with the address of a stack variable.

By the destructor of the object, I meant some
mechanism
for "realeasing" the contained object whithin 
boost::shared_ptr<>. Silly! Not?

So the true answer is not to forget to call the
reset()
member function for every shared_ptr<>, before the end
of it's scope.

Thanks,
--Hossein

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
(Continue reading)

Darin Adler | 1 May 15:32 2003

Re: const shared_ptr<> oops

On Thursday, May 1, 2003, at 04:57 AM, Hossein Haeri wrote:

> So the true answer is not to forget to call the reset() member 
> function for every shared_ptr<>, before the end of it's scope.

No, that won't do any good. When you do a reset(), the shared_ptr 
relinquishes ownership of the thing it points to. If it's the sole 
owner, it will destroy the object. It's simply an error to put a 
pointer to a stack object inside a shared_ptr; you can't correct that 
error with a reset() call.

     -- Darin

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/KXUxcA/fNtFAA/uetFAA/EbFolB/TM
---------------------------------------------------------------------~->

Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe <at> yahoogroups.com>

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

Ben Hutchings | 1 May 16:23 2003
Simon Brown <simon.brown <at> kns.ch> wrote:
> A few days ago I received great help with a regexp question - 
> now here's
> another which I doubt can be done.
> 
> Question: if the text string contains three words AAA BBB AAA 
> then return
> the string (if any) which is repeated two or three times.
> 
> Examples:
> AAA AAA AAA return AAA
> AAA BBB AAA return AAA
> AAA AAA BBB return AAA
> AAA BBB CCC return <nothing>
> 
> Can this be done with a regular expression?

Match against "(\\w+) (?:\\1 \\w+|\\w+ \\1)|\\w+ (\\w+) \\2" and
return the match for whichever sub-expression (1 or 2) was matched.

(I tested this with Python not Boost regex, but they should be
compatible.)

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/O10svD/Me7FAA/uetFAA/EbFolB/TM
---------------------------------------------------------------------~->

Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
(Continue reading)

Alisdair Meredith | 1 May 14:29 2003
Picon

Is there a "known issues" page anywhere?

Is there a place where known problems for libraries/compilers are
stored?

For instance, trying to use boost/time we hit a problem with MSVC7 and
lexical_cast unless we enable the "wchar_t as a native type" option. 
While this may be good practice <g> it is not the default, and caught us
out (and the error is none-too helpful)

I can imagine this sort of issue is discovered and re-discovered on a
regular basis, and wonder where to look for such known issues before
using list bandwidth.

--

-- 
AlisdairM

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Access Your Work PC from Home and leave your Laptop Behind!
http://us.click.yahoo.com/ssvdqB/Wq8FAA/uetFAA/EbFolB/TM
---------------------------------------------------------------------~->

Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe <at> yahoogroups.com>

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

John Harris | 1 May 16:35 2003

Re: const shared_ptr<> oops

--- In Boost-Users <at> yahoogroups.com, Darin Adler <darin <at> b...> wrote:
> On Thursday, May 1, 2003, at 04:57 AM, Hossein Haeri wrote:
> 
> > So the true answer is not to forget to call the reset() member 
> > function for every shared_ptr<>, before the end of it's scope.
> 
> No, that won't do any good. When you do a reset(), the shared_ptr 
> relinquishes ownership of the thing it points to. If it's the sole 
> owner, it will destroy the object. It's simply an error to put a 
> pointer to a stack object inside a shared_ptr; you can't correct 
that 
> error with a reset() call.
> 
>      -- Darin

I agree with Darin.  Shared_ptr is used for automatically deleting a 
heap object when the last reference to it (that is, the last copy of 
the shared_ptr managing it) goes out of scope.  It keeps count as the 
shared_ptr is copied around through parameters and return values and 
is constructed and destroyed.  The underlying count goes up on 
construction and down on destruction.  When the count gets to 
zero, 'delete' is called on your object.

It is used to prevent copies of an object from being made.

Hossein, if you'll post a description of what you really want to do, 
then we might be able to suggest a better idiom for you to follow.

jh

(Continue reading)

Simon Brown | 1 May 16:49 2003
Wow! Thanks for the fast answer, I'm using C++ but now that you show me how
to do this I wonder why I didn't figure it out myself :-)

Simon Brown, Casa Bergenia, CH-7031 Laax
www.hb9drv.ch

----- Original Message ----- 
From: "Ben Hutchings" <ben.hutchings <at> businesswebsoftware.com>

>
> Match against "(\\w+) (?:\\1 \\w+|\\w+ \\1)|\\w+ (\\w+) \\2" and
> return the match for whichever sub-expression (1 or 2) was matched.
>
> (I tested this with Python not Boost regex, but they should be
> compatible.)
>

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading!
Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/cjB9SD/od7FAA/uetFAA/EbFolB/TM
---------------------------------------------------------------------~->

Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe <at> yahoogroups.com>

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

(Continue reading)

Jim.Hyslop | 1 May 22:27 2003

RE: Is there a "known issues" page anywhere?

Alisdair Meredith [mailto:yg-boost-users <at> gmane.org] wrote:
> Is there a place where known problems for libraries/compilers are
> stored?
> 
> For instance, trying to use boost/time we hit a problem with MSVC7 and
> lexical_cast unless we enable the "wchar_t as a native type" option. 
> While this may be good practice <g> it is not the default, 
> and caught us
> out (and the error is none-too helpful)
> 
> I can imagine this sort of issue is discovered and re-discovered on a
> regular basis, and wonder where to look for such known issues before
> using list bandwidth.
There is a "Known Issues" section on the wiki (see the link in the
auto-appended .sig) which is intended to document these common "gotchas". I
haven't looked at it for a while, so I don't know how up-to-date it is.

If that issue's not documented there, would you mind adding it?

--

-- 
Jim

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/O10svD/Me7FAA/uetFAA/EbFolB/TM
---------------------------------------------------------------------~->

Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe <at> yahoogroups.com>
(Continue reading)

Hossein Haeri | 2 May 13:45 2003
Picon

Re: Re: const shared_ptr<> oops

Dear John,

> Hossein, if you'll post a description of what you
> really want to do, 
> then we might be able to suggest a better idiom for
> you to follow.

You are too nice to me because of keeping track of my
issues so much! But I don't have any seroius work to
do on this latter topic, and your previouse answers
were enough for my application. The only point is that
I was trying to purge my mistake. That's all!

But if you want to know about the reason behind my
first question, I'm going to define a new "holder"
object (named so by Bjarne Stroustrup), that is
described in an artocle, which I'm writting these
days.
I would be pleased if I can post a proposal for that
object to Boost, but I don't know how. You will help
me if you can tell me about the way.

Thanks,
--Hossein

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

(Continue reading)


Gmane