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
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
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
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
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,
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
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
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
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
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
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
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
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
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..
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
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
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
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
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
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);
?
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
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
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:
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
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
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
//
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,
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
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.
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
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
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));
|
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
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
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
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
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
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
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
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
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
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
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
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:
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
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* (
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
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
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
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.
101 - 150 of 150 matches
Mail list logo