Blitz logo

Blitz Support :

From: Julian Cummings (cummings_at_[hidden])
Date: 2004-06-11 17:09:32


Hi Patrik,

This is a problem with the blitz array iterators. They are not
currently STL compliant. There have been questions about this from time
to time on the blitz support mailing list. I don't think there is any
fundamental reason why we cannot make the blitz array iterators STL
compliant by adding the expected typedefs and so forth. A couple of
months ago someone else wrote in and mentioned that they had patched the
blitz array iterator code to address this problem. I replied to him and
invited him to submit a patch for inclusion in the blitz repository, but
I don't believe I got a response. I just sent a note to that person
asking again if he can submit his proposed patch. If not, I believe all
that is required is to derive the blitz array iterator class from
std::forward_iterator and fix up the behavior of the prefix and postfix
operator++ to be standard-compliant. Shouldn't be that hard to make
these changes.

Regards, Julian C.

Patrik Jonsson wrote:

> Hello,
>
> I'm trying to construct a vector from an array using:
> Array<double,1> a;
> vector<double> v(a.begin(),a.end());
>
> but it doesn't work. I'm getting compiler errors saying that the
> array iterator class is lacking typedefs (see below). Is this a
> problem with the blitz iterators, or am I doing something wrong?
>
> Regards,
>
> /Patrik
>
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/iterator", line 43: error:
> class
> "blitz::ArrayIterator<blitz::Array<mcrx::T_float,
> 1>::T_numtype, 1>"
> has no member "value_type"
> typedef typename Iterator::value_type value_type;
> ^
> detected during:
> instantiation of class "std::iterator_traits<Iterator> [with
>
> Iterator=blitz::ArrayIterator<blitz::Array<mcrx::T_float,
> 1>::T_numtype, 1>]" at line 69 of
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/vector"
> instantiation of "void std::vector<T,
> Allocator>::_initialize(InputIterator,
> InputIterator,
> std::vector<T, Allocator>::_Helper<false> *) [with
> T=mcrx::T_float,
> Allocator=std::allocator<mcrx::T_float>,
>
> InputIterator=blitz::ArrayIterator<blitz::Array<mcrx::T_f
> loat, 1>::T_numtype, 1>]" at line 128 of
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/vector"
> instantiation of "std::vector<T,
> Allocator>::vector(InputIterator,
> InputIterator, const Allocator &) [with
> T=mcrx::T_float,
> Allocator=std::allocator<mcrx::T_float>,
>
> InputIterator=blitz::ArrayIterator<blitz::Array<mcrx::T_f
> loat, 1>::T_numtype, 1>]" at line 994 of
> "mcrx-extras.cc"
>
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/iterator", line 44: error:
> class
> "blitz::ArrayIterator<blitz::Array<mcrx::T_float,
> 1>::T_numtype, 1>"
> has no member "difference_type"
> typedef typename Iterator::difference_type difference_type;
> ^
> detected during:
> instantiation of class "std::iterator_traits<Iterator> [with
>
> Iterator=blitz::ArrayIterator<blitz::Array<mcrx::T_float,
> 1>::T_numtype, 1>]" at line 69 of
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/vector"
> instantiation of "void std::vector<T,
> Allocator>::_initialize(InputIterator,
> InputIterator,
> std::vector<T, Allocator>::_Helper<false> *) [with
> T=mcrx::T_float,
> Allocator=std::allocator<mcrx::T_float>,
>
> InputIterator=blitz::ArrayIterator<blitz::Array<mcrx::T_f
> loat, 1>::T_numtype, 1>]" at line 128 of
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/vector"
> instantiation of "std::vector<T,
> Allocator>::vector(InputIterator,
> InputIterator, const Allocator &) [with
> T=mcrx::T_float,
> Allocator=std::allocator<mcrx::T_float>,
>
> InputIterator=blitz::ArrayIterator<blitz::Array<mcrx::T_f
> loat, 1>::T_numtype, 1>]" at line 994 of
> "mcrx-extras.cc"
>
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/iterator", line 45: error:
> class
> "blitz::ArrayIterator<blitz::Array<mcrx::T_float,
> 1>::T_numtype, 1>"
> has no member "pointer"
> typedef typename Iterator::pointer pointer;
> ^
> detected during:
> instantiation of class "std::iterator_traits<Iterator> [with
>
> Iterator=blitz::ArrayIterator<blitz::Array<mcrx::T_float,
> 1>::T_numtype, 1>]" at line 69 of
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/vector"
> instantiation of "void std::vector<T,
> Allocator>::_initialize(InputIterator,
> InputIterator,
> std::vector<T, Allocator>::_Helper<false> *) [with
> T=mcrx::T_float,
> Allocator=std::allocator<mcrx::T_float>,
>
> InputIterator=blitz::ArrayIterator<blitz::Array<mcrx::T_f
> loat, 1>::T_numtype, 1>]" at line 128 of
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/vector"
> instantiation of "std::vector<T,
> Allocator>::vector(InputIterator,
> InputIterator, const Allocator &) [with
> T=mcrx::T_float,
> Allocator=std::allocator<mcrx::T_float>,
>
> InputIterator=blitz::ArrayIterator<blitz::Array<mcrx::T_f
> loat, 1>::T_numtype, 1>]" at line 994 of
> "mcrx-extras.cc"
>
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/iterator", line 46: error:
> class
> "blitz::ArrayIterator<blitz::Array<mcrx::T_float,
> 1>::T_numtype, 1>"
> has no member "reference"
> typedef typename Iterator::reference reference;
> ^
> detected during:
> instantiation of class "std::iterator_traits<Iterator> [with
>
> Iterator=blitz::ArrayIterator<blitz::Array<mcrx::T_float,
> 1>::T_numtype, 1>]" at line 69 of
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/vector"
> instantiation of "void std::vector<T,
> Allocator>::_initialize(InputIterator,
> InputIterator,
> std::vector<T, Allocator>::_Helper<false> *) [with
> T=mcrx::T_float,
> Allocator=std::allocator<mcrx::T_float>,
>
> InputIterator=blitz::ArrayIterator<blitz::Array<mcrx::T_f
> loat, 1>::T_numtype, 1>]" at line 128 of
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/vector"
> instantiation of "std::vector<T,
> Allocator>::vector(InputIterator,
> InputIterator, const Allocator &) [with
> T=mcrx::T_float,
> Allocator=std::allocator<mcrx::T_float>,
>
> InputIterator=blitz::ArrayIterator<blitz::Array<mcrx::T_f
> loat, 1>::T_numtype, 1>]" at line 994 of
> "mcrx-extras.cc"
>
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/iterator", line 47: error:
> class
> "blitz::ArrayIterator<blitz::Array<mcrx::T_float,
> 1>::T_numtype, 1>"
> has no member "iterator_category"
> typedef typename Iterator::iterator_category iterator_category;
> ^
> detected during:
> instantiation of class "std::iterator_traits<Iterator> [with
>
> Iterator=blitz::ArrayIterator<blitz::Array<mcrx::T_float,
> 1>::T_numtype, 1>]" at line 69 of
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/vector"
> instantiation of "void std::vector<T,
> Allocator>::_initialize(InputIterator,
> InputIterator,
> std::vector<T, Allocator>::_Helper<false> *) [with
> T=mcrx::T_float,
> Allocator=std::allocator<mcrx::T_float>,
>
> InputIterator=blitz::ArrayIterator<blitz::Array<mcrx::T_f
> loat, 1>::T_numtype, 1>]" at line 128 of
> "/usr/common/usg/KCC/4.0f9/KCC_BASE/include/vector"
> instantiation of "std::vector<T,
> Allocator>::vector(InputIterator,
> InputIterator, const Allocator &) [with
> T=mcrx::T_float,
> Allocator=std::allocator<mcrx::T_float>,
>
> InputIterator=blitz::ArrayIterator<blitz::Array<mcrx::T_f
> loat, 1>::T_numtype, 1>]" at line 994 of
> "mcrx-extras.cc"
> ============================================================
> Patrik Jonsson (831) 459-3809
> Department of Astronomy & Astrophysics
> University of California, Santa Cruz, CA 95064
>
> This message has been written using a voice recognition system.
> Words that don't make sense or not the fault of the author...
>
> _______________________________________________
> Blitz-support mailing list
> Blitz-support_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support

-- 
Dr. Julian C. Cummings                       E-mail: cummings_at_[hidden]
California Institute of Technology           Phone:  626-395-2543
1200 E. California Blvd., Mail Code 158-79   Fax:    626-584-5917
Pasadena, CA 91125