[boost] Re: Any interest in a stats class

2003-02-25 Thread Hubert Holin
Somewhere in the E.U., le 25/02/2003 Bonjour In article [EMAIL PROTECTED], Jason D Schmidt [EMAIL PROTECTED] wrote: I know this is well after the discussion on the stats class has ended, but I think I have a good idea here. Scott Kirkwood proposed a class that behaves something like

RE: [boost] [random] Minor problem with lognormal_distribution

2003-02-25 Thread Bjorn . Karlsson
From: Michael Stevens [mailto:[EMAIL PROTECTED] Correction required for boost/random/lognormal_distribution. Fixed, thanks! Bjorn Karlsson ___ Unsubscribe other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

[boost] Re: Thread-Local Storage (TLS) and templates

2003-02-25 Thread Alexander Terekhov
Ken Hagan wrote: Alexander Terekhov wrote: Uhmm. In return, I venture to suggest that MS-TLS can and shall be characterized as ``utterly busted.'' Fine, but the OP asked about existing practice and the bugs don't change the fact that k can be a template parameter if the compiler is

Re: [boost] Re: Thread-Local Storage (TLS) and templates

2003-02-25 Thread Gabriel Dos Reis
Ken Hagan [EMAIL PROTECTED] writes: | Alexander Terekhov wrote: | | Uhmm. In return, I venture to suggest that MS-TLS can and shall be | characterized as ``utterly busted.'' | | Fine, but the OP asked about existing practice and the bugs | don't change the fact that k can be a template

[boost] possible addition to operators library

2003-02-25 Thread Sam Partington
Hi, While making myself an interim shared_resource class, I found myself reusing the shared_ptr safe-bool conversion, and thought that really the idiom ought to go into the operators library. I am unsure about the name, but for now bool_testable seems to match the naming style used by the rest

[boost] regular expression standardisation proposal

2003-02-25 Thread John Maddock
Guys, In case any of you don't have enough to do (!) I've placed the next draft of my regular expression standardisation proposal at http://www.regex.fsnet.co.uk/n1429dft.htm, as ever comments, nit picks etc are very welcome (the deadline for this revision is Monday the 3rd March). For those of

[boost] [MPL] Doc nitpick

2003-02-25 Thread Thomas Witt
Hi, There is a reference to the 1.29.0 distribution in boost/libs/mpl/doc/index.html#source Shouldn't this be removed before 1.30 is branched? Thomas -- Dipl.-Ing. Thomas Witt Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover voice: +49(0) 511 762 - 4273, fax:

Re: [boost] Re: Re: More metaprogramming problems with MSVC7.0

2003-02-25 Thread Aleksey Gurtovoy
Andreas Huber wrote: P.S. Is it a good idea to use mpl::aux::msvc_eti_base on all platforms (on conforming compilers I'd expect it to call mpl::identity) or should I #ifdef my way around it? Yep, it's intentionally written in the way so that you don't have to #ifdef in your code. Aleksey

Re: [boost] Re: Re: Re: partial proposal

2003-02-25 Thread Aleksey Gurtovoy
Sorry for confusion, the reply below obviously belongs to a different thread. Aleksey Gurtovoy wrote: Andreas Huber wrote: P.S. Is it a good idea to use mpl::aux::msvc_eti_base on all platforms (on conforming compilers I'd expect it to call mpl::identity) or should I #ifdef my way around

Re: [boost] Re: Re: Thread-Local Storage (TLS) and templates

2003-02-25 Thread David Abrahams
Gabriel Dos Reis [EMAIL PROTECTED] writes: Ken Hagan [EMAIL PROTECTED] writes: | Gabriel Dos Reis wrote: | | This analgoy does not cut it: You don't have a function fk by | thread. You have a -single- function designator. And the return | value depends on the calling thread. | |

Re: [boost] [random] Minor problem with lognormal_distribution

2003-02-25 Thread David Abrahams
Michael Stevens [EMAIL PROTECTED] writes: Dear Boosters, This is just a quick reminder of regression before boost_1_30_0 gets released. Without CVS access I can fix it myself and Jens seems to be offline at the moment. It would be great if someone could step in and make a simple correction.

Re: [boost] Re: Thread-Local Storage (TLS) and templates

2003-02-25 Thread David Abrahams
Alexander Terekhov [EMAIL PROTECTED] writes: I have yet to see a compelling reason to embrace the MS ``TLS-template'' innovation. Ah. Well, that's an entirely different matter ;-). I was going on the assumption that there was a reasonable argument for the existence of the feature, and just

Re: [boost] possible addition to operators library

2003-02-25 Thread David Abrahams
Sam Partington [EMAIL PROTECTED] writes: Hi, While making myself an interim shared_resource class, I found myself reusing the shared_ptr safe-bool conversion, and thought that really the idiom ought to go into the operators library. I am unsure about the name, but for now bool_testable

Re: [boost] checked_delete.hpp fix

2003-02-25 Thread Peter Dimov
Daniel Frey wrote: Hi, I came across the following problem: When I have a class X which lives in a namespace where there's a function 'checked_delete' declared that can take a X*, smart_ptr (and probably others) that use checked_deleter (note the 'r'!) cannot call checked_delete. It's

Re: [boost] [MPL] Doc nitpick

2003-02-25 Thread David Abrahams
Thomas Witt [EMAIL PROTECTED] writes: Hi, There is a reference to the 1.29.0 distribution in boost/libs/mpl/doc/index.html#source Shouldn't this be removed before 1.30 is branched? I think Aleksey is planning to check in completely new docs before 1.30 goes out. -- Dave Abrahams Boost

[boost] Question about boost::thread::yield for Win32

2003-02-25 Thread Russell Hind
Is yield intended to always yield to another thread if one can run? Because the code for yield is void thread::yield() { #if defined(BOOST_HAS_WINTHREADS) Sleep(0); #elif defined(BOOST_HAS_PTHREADS) # if defined(BOOST_HAS_SCHED_YIELD) int res = 0; res = sched_yield();

Re: [boost] possible addition to operators library

2003-02-25 Thread Daniel Frey
Essentially you supply a operator! and it supplies an unspecified-bool-type conversion operator. Nice idea! I already had something similar in mind, but you managed to make it really generic. //Key //T: primary operand type //t: values of type T // TemplateSupplied Operations

[boost] Re: Re: Re: Re: Re: Re: partial proposal

2003-02-25 Thread Fernando Cacciola
Peter Dimov [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] David Abrahams wrote: Fernando Cacciola [EMAIL PROTECTED] writes: No, right're right :-) Is perfectly possible to simply discard it, though to me it looks kind of akward in anything but deeply low-level code.

Re: [boost] checked_delete.hpp fix

2003-02-25 Thread David Abrahams
Beman Dawes [EMAIL PROTECTED] writes: Go ahead and make the change, unless someone voices an objection. I'm wondering how may other places we have similar problems? Now you know why I've been making such a stink about insidious ADL! Is there any programatic way to detect them? I've been

[boost] Re: Re: Re: Re: Re: partial proposal

2003-02-25 Thread Philippe A. Bouchard
Philippe A. Bouchard wrote: [...] It's true. Imagine we have some partial specialization of arraybool, size_t: template unsigned int I struct arraybool, I { char value_[I 3]; // Read-only version: bool operator [] (unsigned int a_index) const

Re: [boost] Re: Re: Re: Re: Re: Re: Re: partial proposal

2003-02-25 Thread David Abrahams
Philippe A. Bouchard [EMAIL PROTECTED] writes: David Abrahams wrote: [...] What will happen to a normal type then? What is a normal type? Any type besides optionalT. { T storage = T(x, y, z); // throws // storage.~T() destroys non-existent T Storage never gets constructed

Re: [boost] checked_delete.hpp fix

2003-02-25 Thread Beman Dawes
At 08:34 AM 2/25/2003, David Abrahams wrote: Beman Dawes [EMAIL PROTECTED] writes: Go ahead and make the change, unless someone voices an objection. I'm wondering how may other places we have similar problems? Now you know why I've been making such a stink about insidious ADL! Is there any

RE: [boost] regular expression standardisation proposal

2003-02-25 Thread Keith Burton
A Nit Pick : The column headings in the first table are displaced to the left ( see ECMAScript - comparing ECMA and POSIX regular expressions ) Keith Burton [EMAIL PROTECTED] wrote: Guys, In case any of you don't have enough to do (!) I've placed the next draft of my regular expression

[boost] Re: Re: Re: Re: Re: Re: Re: Re: partial proposal

2003-02-25 Thread Philippe A. Bouchard
David Abrahams wrote: [...] Once again, the case was: { aligned_storageT::type storage; new ((void*)storage) T(x, y, z); // throws // ~aligned_storageT() destroys non-existent T } The question is not what happens if aligned_storageT::type throws. It

Re: [boost] possible addition to operators library

2003-02-25 Thread Daniel Frey
Daniel Frey wrote: The only problem I see is that an instance of safe_bool_conversion is created which is not really needed. I suggest to rely on the operator! provided by T: template class T, class B = ::boost::detail::empty_base struct bool_testable : B { private: typedef bool

Re: [boost] possible addition to operators library

2003-02-25 Thread Sam Partington
Daniel Frey wrote: Nice idea! I already had something similar in mind, but you managed to make it really generic. Not really, all I've done is to borrow the code from shared_ptr, and to put into a shape like one of the existing unary operator helpers in operator.hpp. Thanks anyway though :-)

Re: [boost] checked_delete.hpp fix

2003-02-25 Thread Peter Dimov
Beman Dawes wrote: At 08:34 AM 2/25/2003, David Abrahams wrote: Beman Dawes [EMAIL PROTECTED] writes: Go ahead and make the change, unless someone voices an objection. I'm wondering how may other places we have similar problems? Now you know why I've been making such a stink

Re: [boost] checked_delete.hpp fix

2003-02-25 Thread Peter Dimov
Daniel Frey wrote: Any reason why you went for 'boost::' instead of '::boost::' for the prefix? IMO only the latter expresses exactly what we want or do we rely on user to never create sub-namespaces called 'boost'? Although this is not very likely, we shouldn't place any restrictions on

Re: [boost] possible addition to operators library

2003-02-25 Thread David Abrahams
Sam Partington [EMAIL PROTECTED] writes: I thought of this too, but this limits the user to using a member based operator!. So I couldn't do this : class A : public boost::bool_testableA { public: int get(); }; bool operator!(const A a) { return a.get() == 0; } Of course

Re: [boost] checked_delete.hpp fix

2003-02-25 Thread David Abrahams
Beman Dawes [EMAIL PROTECTED] writes: At 08:34 AM 2/25/2003, David Abrahams wrote: Beman Dawes [EMAIL PROTECTED] writes: Go ahead and make the change, unless someone voices an objection. I'm wondering how may other places we have similar problems? Now you know why I've been

Re: [boost] checked_delete.hpp fix

2003-02-25 Thread David Abrahams
Peter Dimov [EMAIL PROTECTED] writes: Hum, it looks like Microsoft took you up on it. See the shared_ptr_test warning on the VC++ 7.1 beta regression test. No, C4675 is the opposite of what Dave wants. Earlier MSVC didn't support ADL at all, and MSVC 7.1 is now issuing the warning for every

[boost] Re: Re: Re: Re: Re: Re: partial proposal

2003-02-25 Thread Philippe A. Bouchard
Fernando Cacciola wrote: [...] Yes, that's why I was thinking of something that were overloaded for T rather than for optionalT. Anyway, there are still problems with this: operator new is called _before_ the T is constructed, so there won't be a way, AFAICT, to properly set the

Re: [boost] Re: Re: Re: Thread-Local Storage (TLS) and templates

2003-02-25 Thread William E. Kempf
Edward Diener said: William E. Kempf wrote: You can clean up your own TLS index ( or indices ) in your DllMain routine when the seond parameter is DLL_PROCESS_DETACH, meaning that your process is being exited. AFAIK this is the standard way to do this. (Note: The issue is more with

Re: [boost] checked_delete.hpp fix

2003-02-25 Thread Peter Dimov
Daniel Frey wrote: I wasn't thinking of the user to drop things into boost, this is obvbiously not supported. I was thinking of this: namespace foo { namespace boost { // -- Is this allowed by boost? template typename T void checked_delete( T* ); } class A {}; } foo::A*

Re: [boost] possible addition to operators library

2003-02-25 Thread Daniel Frey
Sam Partington wrote: I thought of this too, but this limits the user to using a member based operator!. So I couldn't do this : class A : public boost::bool_testableA { public: int get(); }; bool operator!(const A a) { return a.get() == 0; } Of course I've never

Re: [boost] possible addition to operators library

2003-02-25 Thread Sam Partington
I think I agree, we want to provide as little restrictions as possible. Also seems to me that anyone who declares a global template operator! deserves some problems! So, now with David's suggestion, I've attached what I propose. I've tested to a small extent on MSVC6 and gcc 2.95, which are all

Re: [boost] checked_delete.hpp fix

2003-02-25 Thread Daniel Frey
Peter Dimov wrote: Your example works for me. Qualified identifiers such as boost::checked_delete disable ADL, and foo::boost::checked_delete isn't found. I wasn't aware of this, so I assume that this is the standard's way of handling it and not just some compilers. Thanks. Regards, Daniel

Re: [boost] possible addition to operators library

2003-02-25 Thread David Abrahams
Daniel Frey [EMAIL PROTECTED] writes: Sam Partington wrote: I thought of this too, but this limits the user to using a member based operator!. So I couldn't do this : class A : public boost::bool_testableA { public: int get(); }; bool operator!(const A a) { return

[boost] Re: Question about boost::thread::yield for Win32

2003-02-25 Thread Alexander Terekhov
William E. Kempf wrote: [...] explicit scoped_lock(lightweight_mutex m): m_(m) { while( InterlockedExchange(m_.l_, 1) ) { // Note: changed to Sleep(1) from Sleep(0). // According to MSDN, Sleep(0) will

Re: [boost] possible addition to operators library

2003-02-25 Thread David Abrahams
Sam Partington [EMAIL PROTECTED] writes: I think I agree, we want to provide as little restrictions as possible. Also seems to me that anyone who declares a global template operator! deserves some problems! I don't know why you think so. So, now with David's suggestion, I've attached what

Re: [boost] Re: smart_ptr vs smart_resource

2003-02-25 Thread Rob Stewart
From: Jason House [EMAIL PROTECTED] Well, being relatively a newbie at all this stuff, I have to admit that the initial discussion of performing a lock using a (smart) pointer, seemed odd to me. Someone later clarified that a smart pointer doesn't need to use * and - operators...

Re: [boost] possible addition to operators library

2003-02-25 Thread David Abrahams
Daniel Frey [EMAIL PROTECTED] writes: That won't work as you made it a nested struct so it is still different for all instantiations. I think Dave meant to go for this one: Yup, that's what I meant. BTW, so this safe_bool thing can get further re-used it might make sense to make a special

Re: [boost] possible addition to operators library

2003-02-25 Thread Daniel Frey
David Abrahams wrote: Daniel Frey [EMAIL PROTECTED] writes: That won't work as you made it a nested struct so it is still different for all instantiations. I think Dave meant to go for this one: Yup, that's what I meant. BTW, so this safe_bool thing can get further re-used it might

Re: [boost] partial proposal

2003-02-25 Thread Thomas Wenisch
Hi all, On Tue, 25 Feb 2003, Fernando Cacciola wrote: Peter Dimov [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] templateclass T void * operator new(size_t n, optionalT t); Anyway, there are still problems with this: operator new is called _before_ the T is constructed,

Re: [boost] possible addition to operators library

2003-02-25 Thread David Abrahams
Daniel Frey [EMAIL PROTECTED] writes: David Abrahams wrote: Daniel Frey [EMAIL PROTECTED] writes: That won't work as you made it a nested struct so it is still different for all instantiations. I think Dave meant to go for this one: Yup, that's what I meant. BTW, so this safe_bool

Re: [boost] possible addition to operators library

2003-02-25 Thread Douglas Paul Gregor
On Tue, 25 Feb 2003, David Abrahams wrote: namespace boost { struct safe_bool { int value; typedef int safe_bool::*type; }; } struct myclass { operator boost::safe_bool::type() const { return expression ? boost::safe_bool::value : 0; } };

[boost] Re: possible addition to operators library

2003-02-25 Thread Daniel Frey
On Tue, 25 Feb 2003 21:14:14 +0100, David Abrahams wrote: Daniel Frey [EMAIL PROTECTED] writes: David Abrahams wrote: Daniel Frey [EMAIL PROTECTED] writes: That won't work as you made it a nested struct so it is still different for all instantiations. I think Dave meant to go for

[boost] Re: Re: Re: Re: Thread-Local Storage (TLS) and templates

2003-02-25 Thread Edward Diener
William E. Kempf wrote: Edward Diener said: William E. Kempf wrote: And it's full of issues. You are quite limited in what you can safely do within DllMain. Any calls to synchronization routines is likely to deadlock the entire process. I agree that this is so. You can't sit and wait

[boost] [optional] Polymorphism

2003-02-25 Thread David B. Held
I think optional might be perfect for an issue I have, but there is one catch. I have a polymorphic hierarchy that I would like to use with optional, but optionalBase is not a base of optionalDerived. Of course, this isn't really a problem with optional, par se, but any suggestions on how to

Re: [boost] Re: Re: Re: Re: Thread-Local Storage (TLS) and templates

2003-02-25 Thread William E. Kempf
Edward Diener said: William E. Kempf wrote: Edward Diener said: William E. Kempf wrote: And it's full of issues. You are quite limited in what you can safely do within DllMain. Any calls to synchronization routines is likely to deadlock the entire process. I agree that this is so. You

RE: [boost] Re: smart_ptr vs smart_resource

2003-02-25 Thread Rozental, Gennadiy
This is an excellent point. One doesn't go looking for a class named smart_ptr or a library named Boost.SmartPointer when looking to manage the lifetime of some arbitrary resource. When one uses pointers, it makes sense. I would be searching namely for smart_ptr. I know that smart pointer

RE: [boost] Re: smart_ptr vs smart_resource

2003-02-25 Thread Greg Colvin
When Mark Terribile proposed a class like this way back in the last century I think he called it releaser. At 04:00 PM 2/25/2003, Rozental, Gennadiy wrote: This is an excellent point. One doesn't go looking for a class named smart_ptr or a library named Boost.SmartPointer when looking to

[boost] Re: Re: Re: Re: Re: Thread-Local Storage (TLS) and templates

2003-02-25 Thread Edward Diener
William E. Kempf wrote: Edward Diener said: William E. Kempf wrote: I still don't think it is a TLS issue but rather a thread cleanup issue and the restrictions imposed by MS's design of that situation. So I can well understand your chagrin at the tricks you must do in order to cleanup

RE: [boost] checked_delete.hpp fix

2003-02-25 Thread Jason Shirk
From: David Abrahams Hum, it looks like Microsoft took you up on it. Well, it was MS I was haranguing most-loudly about it. I don't recall a discussion on warnings about ADL, I'll need a refresher. I do recall a discussion we had on non-dependent names. See the shared_ptr_test warning on the

Re: [boost] Re: io operations for stl containers?

2003-02-25 Thread Terje Slettebø
From: Jason House [EMAIL PROTECTED] std::vectorstd::pairchar,int test; std::cout test: // Using defaults (('A',1),('B',2),('C',3)) I would suspect that chars don't get output with '' around them... Right. I was just thinking C++ code, here. :) Is there even a way to

[boost] resource manager naming

2003-02-25 Thread Dave Gomboc
I would be searching namely for smart_ptr. I know that smart pointer is the name for the resource management idiom. But those that don't would look for resource_manager or resource_mgr (and might even find res_mgr). The smart_ prefix is quite useless in this context, there isn't an old

[boost] Re: [optional] Polymorphism

2003-02-25 Thread Fernando Cacciola
David B. Held [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] I think optional might be perfect for an issue I have, but there is one catch. I have a polymorphic hierarchy that I would like to use with optional, but optionalBase is not a base of optionalDerived. Of course,

[boost] Re: Re: Re: Re: Re: partial proposal

2003-02-25 Thread Philippe A. Bouchard
Fernando Cacciola wrote: [...] That would have to be _measured_; my guess is that it could be twice slower, specially considering that I don't think boost sources will ever include assembly code; it's a portability nightmere. I've just generated some code, and the compiler can even optimize

[boost] Re: checked_delete.hpp fix

2003-02-25 Thread Nicola Musatti
Daniel Frey wrote: On Tue, 25 Feb 2003 08:34:43 +0100, Nicola Musatti wrote: [...] I don't have a strong opinion in either direction, but I do feel that it is important that this is thought over. Overloading checked_delete() on purpose in a user defined namespace might be considered a way to