Re: [eigen] A question for MSVC experts |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] A question for MSVC experts
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 15 Jun 2011 09:00:59 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=H4L5wfcd4D60YUomizSC4y/rhs4QNJWfBwtcitpTS30=; b=F0wU14eK4gKdgfeedQ4710c3/ZsHXD5Idac1vF5wKiS6SfbB8s+qCqq31ZIP0itdfP obrExmnLFj6RYicEgc4/+cVLc9Nz+vnegYKxmin/Dx2wgoDahq2C+Vw0uVz3FBVjFDCd 7aV1dgoj44vW3S2wIFiI4Drsrdu3VWwp4onqw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=wrdqfOm4bcu56YEiHLxB2Hh6aZl5jnY9Zs2zVLs1K2GbIz6Y3w77YOqcYwx1rN8aN6 KQYCU9xYChnV5/jzhS61SLPQWOazQKsrGCKiAY5JzqU1HmGkOg7D4koCurp3FVU4uhfO oe65+63mhNDyZ7r4TP4UGqyrR5R0ZaHFhRniY=
Hi,
yes I understand the "shadowing" mechanism, but why do we have to
define them at all in the derived class since they *all* simply call
their respective base class method?
Also I think that the "2 overloads have similar conversions" issue is
probably because they are not correctly defined: they are defined
using "const_iterator" instead of "iterator".
gael
On Tue, Jun 14, 2011 at 11:38 PM, Jose Luis Blanco
<joseluisblancoc@xxxxxxxxx> wrote:
> Hi Gael,
>
> Short answer: To avoid the class breaking code expecting a std::vector
>
> Long answer: The STL standard defines three overloaded insert() methods:
>
> iterator insert ( iterator position, const T& x );
> void insert ( iterator position, size_type n, const T& x );
> template <class InputIterator>
> void insert ( iterator position, InputIterator first, InputIterator last );
>
> ( http://www.cplusplus.com/reference/stl/vector/insert/ )
>
> and since if one defines a method in a derived class with the same
> name than in the base class the former "shadows" all other overloads,
> all the overloaded versions must be defined again in the derived class
> to make them visible.
>
>
> Now, what should be investigated is the actual reason of the error and
> fix it! ;-)
> At first sight I don't see the problem. Could you try leaving those
> two lines just as:
>
> using vector_base::insert;
> iterator insert(const_iterator position, const value_type& x);
> void insert(const_iterator position, size_type new_size, const value_type& x);
>
> to discard the problem is the methods implementation and not their declaration??
>
> JL
>
> On Tue, Jun 14, 2011 at 9:05 PM, Gael Guennebaud
> <gael.guennebaud@xxxxxxxxx> wrote:
>> Hi,
>>
>> in StdVector.h, for MSVC we have the following lines:
>>
>> using vector_base::insert;
>> iterator insert(const_iterator position, const value_type& x)
>> { return vector_base::insert(position,x); }
>> void insert(const_iterator position, size_type new_size, const value_type& x)
>> { vector_base::insert(position, new_size, x); }
>>
>> On win32 builds this seems to produce compilation errors like:
>>
>> "2 overloads have similar conversions"
>>
>> Actually, I don't really understand the purpose of these two overloads
>> of insert(). Same for push_back which is simply implemented as:
>>
>> void push_back(const value_type& x)
>> { vector_base::push_back(x); }
>>
>> According to this thread:
>> http://forum.kde.org/viewtopic.php?f=74&t=95499 removing these lines
>> fix the issue and does not introduce new errors.
>>
>> So does anybody remember what was their purpose?
>>
>> Gael
>>
>>
>>
>
>
>
> --
> ___________________________________________________________
>
> Dr. Jose-Luis Blanco-Claraco
> Dpt. Ing. Civil, Mat. y Fabric - Phone: +34 951 952435
> E.T.S.I. Industriales - Despacho 2.037
> Universidad de Malaga - Campus Universitario de Teatinos
> 29071 Malaga, Spain
> https://sites.google.com/site/jlblancosite/
> ___________________________________________________________
>
>
>