Re: [boost] Metaprogramming: Using static const or enum?

2003-01-11 Thread Terje Slettebø
From: Paul Mensonides [EMAIL PROTECTED] 14.3.1/2 [quote-- A local type, a type with no linkage, an unnamed type or a type compounded from any of these types shall not be used as a template-argument for a template type-parameter. --end quote] Incidently, an unnamed type has no

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-11 Thread Terje Slettebø
From: Gabriel Dos Reis [EMAIL PROTECTED] What I find confusing about the current rule is that it makes an exception for integral type const static data member. I think the old rule was less irregular. (Strangely enought, for long time -- since the publication of TC++PL3 in 1997 -- I've

[boost] Possibly new configuration macro for Boost.Config

2003-01-09 Thread Terje Slettebø
Hi. While working on the lexical_cast proposition, I found that the following code works on Comeau C++, GCC 3.2 and Borland C++ Builder 6.0, but fails on Intel C++ 7.0, in strict mode: #include string templateclass Result,class T void f(Result,T) {} templateclass Result,class CharType,class

[boost] Re: Possibly new configuration macro for Boost.Config

2003-01-09 Thread Terje Slettebø
From: Terje Slettebø [EMAIL PROTECTED] Hm. Given that BCB 6.0 gives an error on another part of the test program (the call f(str,str) is reported as ambiguous), and I need to check for that compiler, as well, maybe one could have a more general configuration macro, like

Re: [boost] Possibly new configuration macro for Boost.Config

2003-01-09 Thread Terje Slettebø
From: John Maddock [EMAIL PROTECTED] While working on the lexical_cast proposition, I found that the following code works on Comeau C++, GCC 3.2 and Borland C++ Builder 6.0, but fails on Intel C++ 7.0, in strict mode: If it is that compiler specific, and is only effecting one library,

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-09 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] Terje Slettebø [EMAIL PROTECTED] writes: And since there are techniques for making out-of-class definitions easier (and automatic), which may be instantiated if needed, like you showed, then static const seems clearly best. That's not nearly so

Re: [boost] std::wstring exists on GCC 3.2?

2003-01-08 Thread Terje Slettebø
From: John Maddock [EMAIL PROTECTED] I've tried to compile something which uses std::wstring on GCC 3.2 (MinGW), but I get the following error at link-time: undefined reference to `std::basic_stringwchar_t, std::char_traitswchar_t, std::allocatorwchar_t ::basic_string()' Using

Re: [boost] Re: notation question

2003-01-08 Thread Terje Slettebø
From: Vladimir Prus [EMAIL PROTECTED] Pavol Droba wrote: I have following two variants of the same function: // find_first sequence const version template typename InputT, typename SearchT inline iterator_range typename InputT::const_iterator find_first( const

Re: [boost] Re: Small thing: yes_type and no_type made public?

2003-01-08 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] Paul Mensonides [EMAIL PROTECTED] writes: [EMAIL PROTECTED] (Hartmut Kaiser) writes: // The following expands to // // typedef char (sizeN_t)[N]; // // for N = 1..BOOST_MAX_SIZETYPE_COUNT #define SIZETYPE(z, n, nil) \ typedef

[boost] Metaprogramming: Using static const or enum?

2003-01-07 Thread Terje Slettebø
Hi. BOOST_STATIC_CONST is defined in Boost.Config as: # ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment } # else # define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment # endif Thus, it prefers

[boost] Small thing: yes_type and no_type made public?

2003-01-07 Thread Terje Slettebø
The types yes_type and no_type (or equivalent) - that is, two types which are guaranteed to have different size - is used extensively for Boost type traits, and also in some other libraries (iterator.hpp, named_template_params.hpp, multi_array, Phyton and signals). Some places use the type traits

Re: [boost] Small thing: yes_type and no_type made public?

2003-01-07 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] Terje Slettebø [EMAIL PROTECTED] writes: The types yes_type and no_type (or equivalent) - that is, two types which are guaranteed to have different size - is used extensively for Boost type traits, and also in some other libraries (iterator.hpp

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread Terje Slettebø
From: Gennaro Prota [EMAIL PROTECTED] On Tue, 7 Jan 2003 15:35:56 +0100, Terje Slettebø [EMAIL PROTECTED] wrote: [...] I like static const, as I think it conveys more succinctly what it's about, and the enum appears more like a hack (for compilers not handling static const in-class

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread Terje Slettebø
From: Paul Mensonides [EMAIL PROTECTED] Just my 2 cents. Make that 3 cents... In summary, enumerations are distinct types and therefore can interfere with the rest of the language. Particularly, constant expressions, overloading, operator overloading, template type deduction, etc..

Re: [boost] Hello MPL world!

2003-01-06 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] Aleksey and I are trying to think of a simple metaprogramming problem which we could use as a sort of Hello World example for the MPL. This seems to be a rather hard problem. Aside from being short, a C++ hello, world introduces only two library

Re: [boost] Re: Hello MPL world!

2003-01-06 Thread Terje Slettebø
From: Alisdair Meredith [EMAIL PROTECTED] Terje Slettebø wrote: The results don't necessarily have to be printed out at compile-time (Erwin Unruh printed the results using compiler-warnings, but that is of course highly implementation dependent). Hello, world in compile-time

Re: [boost] Hello MPL world!

2003-01-06 Thread Terje Slettebø
From: Yitzhak Sapir [EMAIL PROTECTED] I think storing the text Hello world! in a vector typedef vector13_cchar, 'H','e','l','l','o',' ', 'w','o','r','l','d','!','\n' hello_world; And then using functors to print it such as: template class Prev, class T struct print { static

[boost] std::wstring exists on GCC 3.2?

2003-01-05 Thread Terje Slettebø
Hi. I've tried to compile something which uses std::wstring on GCC 3.2 (MinGW), but I get the following error at link-time: undefined reference to `std::basic_stringwchar_t, std::char_traitswchar_t, std::allocatorwchar_t ::basic_string()' Using std::string works fine. Doesn't GCC 3.2 support

Re: [boost] std::wstring exists on GCC 3.2?

2003-01-05 Thread Terje Slettebø
From: Lars Gullik Bjønnes [EMAIL PROTECTED] Terje Slettebø [EMAIL PROTECTED] writes: | I've tried to compile something which uses std::wstring on GCC 3.2 (MinGW), | but I get the following error at link-time: Gcc 3.2 have wstring... could the problem be how MinGW is configured? It could

Re: [boost] [MPL] naming question

2003-01-04 Thread Terje Slettebø
From: Aleksey Gurtovoy [EMAIL PROTECTED] How would you call an 'apply' counterpart that takes a metafunction class and a _sequence_ of arguments, i.e.: typedef list_cint,5,0 args; typedef apply_tuple plus, args ::type sum; // this one BOOST_STATIC_ASSERT(sum::value == 5); ?

Re: [boost] [MPL] naming question

2003-01-04 Thread Terje Slettebø
From: Terje Slettebø [EMAIL PROTECTED] From: Aleksey Gurtovoy [EMAIL PROTECTED] How would you call an 'apply' counterpart that takes a metafunction class and a _sequence_ of arguments, i.e.: template struct plusdefault_type, default_type { templateclass T1, class T2, class T3, class

Re: [boost] [MPL] naming question

2003-01-04 Thread Terje Slettebø
From: Aleksey Gurtovoy [EMAIL PROTECTED] With it, you might have used: template struct plusdefault_type, default_type { templateclass T1, class T2, class T3, class T4, class T5 struct apply { ... } templateclass Sequence struct apply { ... } }; Yes, except that I

Re: [boost] Re: New MPL meta-functions, and a question

2003-01-04 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] Jaap Suter [EMAIL PROTECTED] writes: Mm, I still don't quite understand. Consider the following function: void foo( int_c 0 ); Shouldn't the following code: foo( int_c minus int_c 4 , int_c 4 ::type ); Behave the same as this:

Re: [boost] Boost unit test suggestion - checkpoints for exceptions

2003-01-01 Thread Terje Slettebø
From: Paul Mensonides [EMAIL PROTECTED] From: Terje Slettebø [EMAIL PROTECTED] To do that (without changing the Boost unit test code), I made a few forwarding macros, like this: #define BOOST_CHECK_EQUAL_CP(a,b)\ BOOST_CHECKPOINT(BOOST_CHECK_EQUAL(##BOOST_STRINGIZE(a)##,##BOOST_STRING

Re: [boost] class/typename for template parameters (was: Re: Re:Using MPL on MSVC7)

2002-12-31 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] Lastly, I know that Aleksey will argue with me about this, but I have a strong preference for class rather than typename in template parameter lists. Aside from the fact that it's longer, typename is visually confusable because it can mean other

Re: [boost] class/typename for template parameters (was: Re: Re:Using MPL on MSVC7)

2002-12-31 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] template typename T, typename U = typename metafunctionT::type vs template class T, class U = typename metafunctionT::type Of course it also appears between ... in other contexts. Yes, for example: templatetypename T, typename T::type U //

[boost] Boost unit test suggestion - checkpoints for exceptions

2002-12-31 Thread Terje Slettebø
Hi. I'm currently converting the unit tests for the lexical_cast proposition, to use the Boost unit test framework. It's very good, and it replaces my more ad-hoc unit test. There's one thing I'm wondering about. If you get an exception in a test, it won't show which line caused the exception,

Re: [boost] Re: lexical_cast Future directions

2002-12-30 Thread Terje Slettebø
From: Thomas Witt [EMAIL PROTECTED] Kevlin Henney wrote: This is the philosophy that Kevlin and I agreed on when lexical_cast was first introduced. However, I don't think it has stood the test of time with real users, and it would be stupid to ignore that. I Agreed. I see the problem, I

Re: [boost] Re: [Config] Testing instructions for compiler vendors

2002-12-16 Thread Terje Slettebø
From: Paul Mensonides [EMAIL PROTECTED] From: David Abrahams [EMAIL PROTECTED] I understand what you're saying, but I think inline if doesn't reflect what it's doing and IIF is still not memnonic. It ultimately from (don't laugh) VB's version of the ternary operator--called iif.

Re: [boost] Re: Re: dynamic_void_cast

2002-12-11 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] Terje Slettebø [EMAIL PROTECTED] writes: I understand you (Johan) want to be able to have generic factories, but then erasing the type is probably not the way to go, and as has been pointed out in this thread, void * is type erasure. More or less

Re: [boost] Re: Re: dynamic_void_cast

2002-12-11 Thread Terje Slettebø
From: Alan Bellingham [EMAIL PROTECTED] Terje Slettebø [EMAIL PROTECTED]: in this thread, void * is type erasure. More or less the only safe thing you can do with it, is to delete it. You can also cast it back to its original [snip David Abrahams demurral] Of course, it depends on whether

Re: [boost] dangerous_cast

2002-12-04 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] Gabriel Dos Reis [EMAIL PROTECTED] writes: David B. Held [EMAIL PROTECTED] writes: | Does this have any merit whatsoever? | | template typename T, typename U | T* dangerous_cast(U* p) | { | return static_castT*(static_castvoid*(p)); |

Re: [boost] dangerous_cast

2002-12-04 Thread Terje Slettebø
From: Terje Slettebø [EMAIL PROTECTED] From: David Abrahams [EMAIL PROTECTED] Gabriel Dos Reis [EMAIL PROTECTED] writes: Is it any different from reinterpret_castT*(p) ? It might be, depending on your compiler. The behavior of reinterpret_castT* is implementation-defined. Doesn't

Re: [boost] Boost License Issues

2002-12-03 Thread Terje Slettebø
From: Sean Parent [EMAIL PROTECTED] 5. Disclaimers such as AS IS are strongly discouraged - they are viewed as a statement that the file may or may not contain other copyrighted or patented work. Disclaimers weaken the copyrights granted. 90% of the time this is where I get involved in a

Re: [boost] Boost License Issues

2002-12-03 Thread Terje Slettebø
Another important point is that Boost is a source library, so that the users aren't dependent on the Boost commonity, if something needs fixing, unlike if it was binary components. Anybody could in theory support it, and there are companies, such as Dave Abrahams et al's Boost Consulting, who

Re: [boost] lexical_cast and Unicode

2002-11-30 Thread Terje Slettebø
From: Jasper van de Gronde [EMAIL PROTECTED] I use lexical_cast a lot, but when I tried to use it in a program that uses Unicode I noticed it failed because it uses a standard stringstream. To solve my problem I simply added another #ifdef that checked for UNICODE and would then use

Re: [boost] lexical_cast and Unicode

2002-11-30 Thread Terje Slettebø
Speaking of different character types, perhaps there could also be interest for converting between strings of different character types, as well? For example: std::string str=lexical_caststd::string(LA wide character string); std::wstring wstr=lexical_caststd::wstring(A character string); and

Re: [boost] Re: Boost License Issues

2002-11-30 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] Iain K.Hanson [EMAIL PROTECTED] writes: [mailto:[EMAIL PROTECTED]]On Behalf Of David B. Held Sent: 26 November 2002 21:26 [snip] Perhaps a special clause that the software does not infringe on any known patents or copyrights, but comes with no

Re: [boost] Re: Boost License Issues

2002-11-30 Thread Terje Slettebø
From: David Abrahams [EMAIL PROTECTED] Terje Slettebø [EMAIL PROTECTED] writes: From: David Abrahams [EMAIL PROTECTED] My meeting with a technology lawyer at Harvard last week led me to believe that boost authors are already opened up to having to defend against a patent suit. We

Re: [boost] offset_cast proposal

2002-11-25 Thread Terje Slettebø
From: Pavol Droba [EMAIL PROTECTED] On Sun, Nov 24, 2002 at 07:27:42PM +0100, Terje Sletteb? wrote: For example, if you have a buffer like this (starting at an aligned address): +0 - One byte +1 - Number 1 +5 - Number 2 +9 - Number 3 Even if you have a struct with three

Re: [boost] Boost License Issues

2002-11-25 Thread Terje Slettebø
From: Chris Little [EMAIL PROTECTED] on 11/25/02 2:13 PM, Paul A. Bristow at [EMAIL PROTECTED] wrote: So should we use Copyright (c), 2002, A N Author to cover as many countries/lawyers as possible? But do we need to update the year for each release (perhaps twice a year?)? What

Re: [boost] offset_cast proposal

2002-11-24 Thread Terje Slettebø
From: Pavol Droba [EMAIL PROTECTED] I have developed a simple cast function which I found very useful. Here it is: template typename T inline T offset_cast( void* p, unsigned int offset=0 ) { return reinterpret_cast T ( static_castunsigned char*( p )+offset ); } template typename T

Re: [boost] offset_cast proposal

2002-11-24 Thread Terje Slettebø
From: Pavol Droba [EMAIL PROTECTED] On Sun, Nov 24, 2002 at 01:26:05PM +0100, Terje Sletteb? wrote: From: Pavol Droba [EMAIL PROTECTED] I have developed a simple cast function which I found very useful. Here it is: template typename T inline T offset_cast( void* p, unsigned

Re: [boost] offset_cast proposal

2002-11-24 Thread Terje Slettebø
From: Pavol Droba [EMAIL PROTECTED] The prerequisite I haven't mentioned is that if you wan to use a structure to map to such a buffer, it has to have 1 byte aligmnent. Most of the compilers allow this kind of specification with pragmas. Reinterpret-cast could be avoided like this:

Re: [boost] offset_cast proposal

2002-11-24 Thread Terje Slettebø
From: Pavol Droba [EMAIL PROTECTED] Sorry for sending this as several mails. template typename T inline T offset_cast( void* p, unsigned int offset=0 ) { return reinterpret_cast T ( static_castunsigned char*( p )+offset ); } There is also the issue of the interface. This cast, unlike the

Re: [boost] offset_cast proposal

2002-11-24 Thread Terje Slettebø
On Sun, Nov 24, 2002 at 07:27:42PM +0100, Terje Sletteb? wrote: From: Pavol Droba [EMAIL PROTECTED] Reinterpret-cast could be avoided like this: template typename T inline T* offset_cast( void* p, unsigned int offset=0 ) { return static_castT*( static_cast void* (

Re: [boost] Re: Win32 regressions on main trunk updated

2002-11-16 Thread Terje Slettebø
From: John Maddock [EMAIL PROTECTED] Well, it was intentional, if not very smart. The idea was that the config files essentially allowed workarounds for platform deficiencies, so if your platform was conformant, you did not need them. Including the config from the headers hides from the

Re: [boost] Re: Copy Constructible Concept

2002-11-16 Thread Terje Slettebø
From: Gennaro Prota [EMAIL PROTECTED] On Sat, 16 Nov 2002 00:07:11 +0100, Terje Slettebø [EMAIL PROTECTED] wrote: From: Gennaro Prota [EMAIL PROTECTED] Who knows? When I encounter these sorts of situations I dream a standard where propositions can be demonstrated like in mathematics

Re: [boost] Re: Copy Constructible Concept

2002-11-15 Thread Terje Slettebø
From: Gennaro Prota [EMAIL PROTECTED] On Fri, 15 Nov 2002 16:05:05 -0500, David Abrahams [EMAIL PROTECTED] wrote: Douglas Gregor [EMAIL PROTECTED] writes: You'll have to back that up with some standardese. AFAICT, 5.2.10/10 lets addressof() work: That is, a reference cast

Re: [boost] Re: Copy Constructible Concept

2002-11-15 Thread Terje Slettebø
From: Gennaro Prota [EMAIL PROTECTED] --- David Abrahams [EMAIL PROTECTED] wrote: Gennaro Prota [EMAIL PROTECTED] writes: Who knows? When I encounter these sorts of situations I dream a standard where propositions can be demonstrated like in mathematics or counter-examples provided.

<    1   2