Joe Gottman | 1 Jan 2004 01:47
Picon

Re: Why a reference-linked shared_ptr?


"Rogier van Dalen" <R.C.van.Dalen <at> umail.leidenuniv.nl> wrote in message
news:3FF2DE42.20600 <at> umail.leidenuniv.nl...
> Hi all,
>
> First of all, I'm not sure this is the correct place to discuss this.
> Please point me to a better place if it's not.
>
> "A proposal to add general purpose smart pointers to the library"
> http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1450.html
> is based mostly on the boost shared_ptr. It explicitly allows a
> reference-linked implementation though (III.A.4). Why? According to
> Andrei Alexandrescu (Modern C++ Design 7.5) the only advantage of that
> is that no extra object (reference counter) has to be allocated. I have
> not been able to think of or find any other advantage.
> But what to do with the deleter then, whose type is not in the
> shared_ptr template parameter list? There must be something I'm missing,
> or otherwise a linked list  implementation of shared_ptr is forced to
> allocate at least some free store for the deleter (or a vtable) -- 
> rendering the advantage void.
>
> Regards,
> Rogier

   Try posting this to the comp.std.c++ newsgroup.

Joe Gottman

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
(Continue reading)

Stephan T. Lavavej | 1 Jan 2004 01:47
Picon
Favicon

Suspected Regex Bug

Asking for non-greedy repeats can change /whether/ an expression matches,
which seems to be blatantly wrong.

C:\Temp\boost>type test.cc
#include <iostream>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;

int main() {
    cout << regex_match("a", regex(".*")) << endl;
    cout << regex_match("a", regex(".*?")) << endl;
}

C:\Temp\boost>g++ -Wall -W test.cc -o test.exe -lboost_regex

C:\Temp\boost>test
1
0

C:\Temp\boost>

This was originally encountered when trying to strip leading and trailing
whitespace from a string in one step.  It turns out that

regex_merge(s, regex("\\A\\s*(\\S*(\\s+\\S+)*)\\s*\\z"), "$1");

will work correctly, but the "obvious"

regex_merge(s, regex("\\A\\s*(.*?)\\s*\\z"), "$1", format_no_copy);
(Continue reading)

Roland | 1 Jan 2004 14:40
Picon

Re: Re: Boost.Thread: Wrapping Native Windows Event Variables possible?

(Michael Glassford <glassfordm <at> hotmail.com>) wrote:

> > Should I simply unlock the mutex before entering WaitForMultipleObjects?
> 
> It's hard to say without knowing what exactly the mutex is protecting. 
> Perhaps you could post some sample code?
> 

Ok I will try to pull something out of my developement code.

> > There is no user accessible API for such an operation. 

Oh thank you, I somehow overlocked this fact. Using this I´ll post the following code.
(Which is a blocking, but cancelable write function.)
Say you have a port object, whose functions are protected by a monitor.
(This is for the Windows API.)

size_t tcp_port::write(const byte* p, size_t c)
{
DWORD dw;
MSG msg;
HANDLE rgev[2];
DWORD ev;

    lock lk(monitor);

    if (!WriteFile(m_h, p, c, &dw, &m_ovWrite)) {
        if (ERROR_IO_PENDING == GetLastError()) {
            regev[0] = m_evWrite;
            regev[1] = m_evCancel;
(Continue reading)

Daryle Walker | 1 Jan 2004 19:03
Picon
Favicon

Re: Quick Thought on Pointer Containers

On 12/27/03 8:23 AM, "Thorsten Ottosen" <nesotto <at> cs.auc.dk> wrote:

> "Daryle Walker" <darylew <at> hotmail.com> wrote in message
> news:BC1298B4.43CF%darylew <at> hotmail.com...
>> 1.  Maybe you should rename the library.  I haven't imagined:
>> 
>> I wish I had a container of (smart) pointers that held polymorphic or
>> non-polymorphic objects.
>> 
>> But I have imagined:
>> 
>> I wish there was a container that could hold objects that were scattered
>> across a class hierarchy.
>> 
>> Think of the solution space, not the implementation space
> 
> Is this a riddle of some kind :-) I'm sorry Daryle, but I don't quite
> understand. There is one other name I have though of, smart containers, but
> that seems a bit pop-smart.

You can think of a class as:
1. How it is implemented
2. What problems it solves

You keep focusing on [1] (cool method of using pointers within containers).
As an user, I don't care about [1]; I only care about [2] (storing
Polymorphic Heterogeneous objects in the same container).  Your naming could
reflect that (e.g. "ph_vector").

--

-- 
(Continue reading)

David Abrahams | 1 Jan 2004 19:53
Picon
Picon
Favicon
Gravatar

Re: Remaining GCC failures

Beman Dawes <bdawes <at> acm.org> writes:

> As far as the Boost regression tests go, there hasn't be a lot of
> progress with GCC. The same Boost tests have been failing for the last
> four or five GCC releases, regardless of operating system.
>
> This sounds to me as if the Boost developers must think the problems
> lie with GCC (or just plain aren't paying attention), while the GCC
> folks think the problems lie with Boost (or just plain aren't paying
> attention).
>
> Someone needs to step forward and break the log-jam. File bug reports,
> email developers, and make sure someone is actively working on each
> issue. I've been doing that with Intel, Metrowerks, and Microsoft and
> it does work, typically resulting in fixes for both Boost and compiler
> (or occasionally std library) code.
>
> Any volunteers for GCC?

Don't we know the maintainers for each of the libraries with
failures?  Can't we ask them directly?

--

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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

(Continue reading)

Daniel Wallin | 1 Jan 2004 21:30
Picon
Picon
Favicon

Interest in smart pointer with value semantics?

Is there any interest in adding something like this to boost? Like
shared_ptr<>, all type-information is captured at the point of
construction, so the default generated copy constructor, assignment and
destructor works for deep copying of incomplete types.

Very useful for pimpl classes and for storing polymorphic objects.

   http://www.cs.umu.se/~ens01dwn/value_ptr.hpp

--

-- 
Daniel Wallin

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Pavel Vozenilek | 1 Jan 2004 18:56
Picon
Favicon

[noncopyable.hpp] small fix for Borland

Empty class in Borland C++ Builder has by default 8 bytes. These 8 bytes are
not removed by EBO and only increase descendants size.

boost::noncopyable is such class.

Could it be please changed to:

--------------
class noncopyable
{
#if (defined __BORLANDC__) && (__BORLANDC__ <= 0x564)
    char dummy; // BCB would use 8 bytes by default
#endif
 protected:
 ....
--------------

/Pavel

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Kris Braun | 1 Jan 2004 21:34

(no subject)

Hi all,

When compiling a lexical_cast< int >( foo ) call using MSVC 7.1 with /W4, I get a C4701 "unreferenced
variable" warning. This is because the compiler doesn't know that the throw_exception function never
returns. This warning can be fixed by adding "__declspec( noreturn )" before "void throw_exception". I
would generate a patch, but I'm unsure how long noreturn has been supported by the compiler, so I don't know
what kind of conditional to use. 

Thanks for the great library!

Cheers,
Kris 

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reece Dunn | 1 Jan 2004 22:23
Picon
Favicon

RE: lexical_cast warnings in MS VC7.1 (was: (no subject))

Kris Braun wrote:

>When compiling a lexical_cast< int >( foo ) call using MSVC 7.1 with /W4, I 
>get a
>C4701 "unreferenced variable" warning. This is because the compiler doesn't 
>know that
>the throw_exception function never returns. This warning can be fixed by 
>adding
>"__declspec( noreturn )" before "void throw_exception". I would generate a 
>patch,
>but I'm unsure how long noreturn has been supported by the compiler, so I 
>don't know what kind of conditional to use.

I get 3 types of warnings:

[1] C4511: copy constructor could not be generated; C4512 assignment 
operator could not be generated
   at lexical_cast.hpp(181)

This is fixample by replacing line 125 with:
+ class lexical_stream: public boost::noncopyable
- class lexical_stream

and adding
+ #include <boost/noncopyable.hpp>
at the top of the file.

[2] C4701: local variable 'result' may be used without having been 
initialized
   at lexical_cast.hpp(191)
(Continue reading)

David B. Held | 1 Jan 2004 22:58

Re: Interest in smart pointer with value semantics?

"Daniel Wallin" <dalwan01 <at> student.umu.se> wrote in message
news:3FF4834A.9060608 <at> student.umu.se...
> [...]
> Very useful for pimpl classes and for storing polymorphic objects.
>
>    http://www.cs.umu.se/~ens01dwn/value_ptr.hpp

Looks like it could be spelled: smart_ptr<T, deep_copy>, if
someone would ever finish that thing. ;)

Dave

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 12/26/2003

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Gmane