RE: [Boost-Users] array -v- array_traits
Duane Murphy [SMTP:duanemurphy@mac.com] wrote:
I noticed that array.hpp uses
#ifndef BOOST_ARRAY_HPP #define BOOST_ARRAY_HPP .. #endif
and array_traits.hpp uses:
#if !defined(BOOST_ARRAY_HPP) #define BOOST_ARRAY_HPP 1 .. #endif
This means that you cant use them both at the same time? The first one wins?
These are certainly similar classes but they dont seem to collide.
Is this a subtle bug or intentional? Hi, Duane.
I don't know the answer, but I've cc'd this to the Boost developer's list. Someone there should have an answer ;-) -- Jim Hyslop (moderator, Boost-Users group)
on 10/25/01 2:02 PM, Jim.Hyslop at jim.hyslop@leitch.com wrote:
Duane Murphy [SMTP:duanemurphy@mac.com] wrote:
I noticed that array.hpp uses
#ifndef BOOST_ARRAY_HPP #define BOOST_ARRAY_HPP .. #endif
and array_traits.hpp uses:
#if !defined(BOOST_ARRAY_HPP) #define BOOST_ARRAY_HPP 1 .. #endif
Is this a subtle bug or intentional?
It's a bug. I'll fix it in cvs right now. The array_traits.hpp predates array.hpp, and is still marked "beta", but I love it, use it a lot, and wish it wasn't marked "beta". Maybe I should take it through the formal review process. -- Darin
--- At Thu, 25 Oct 2001 14:19:58 -0700, Darin Adler wrote:
It's a bug.
I'll fix it in cvs right now.
The array_traits.hpp predates array.hpp, and is still marked "beta", but I love it, use it a lot, and wish it wasn't marked "beta". Maybe I should take it through the formal review process.
Thanks Darin. I am wondering, can you explain further why you prefer array_traits to array? I was trying to decide which to use for a const char array that needed container semantics. Neither of these do well with the darned terminator; the array is always one to big, so you have to resort to array syntax for characters that's kind of messy. Maybe there is a better choice. const array< char, 2 > delim = { { '%', '%' } }; // This syntax is always needed for array<> then use container syntax ie delim.begin(), delim.end(); or const delim = { '%', '%' }; // using "%%" is an array of size 3 instead of 2. the use boost::begin( delim ), boost::end( delim ). Your opinion would be most useful. ..Duane
participants (3)
-
Darin Adler
-
Duane Murphy
-
Jim.Hyslop