C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VC++ 8 Pb

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
korchkidu
Guest





PostPosted: Thu May 19, 2005 9:37 am    Post subject: VC++ 8 Pb Reply with quote



Bonojour,

ce programme ne compile pas sous VC++ 8:

int main()
{
vector<bool> vb;
vector<bool>::iterator it; // <-- COMPILATION ERROR
return 0;
}

quelqu'un pourrait m'expliquer pourquoi?

Merci
K.
Back to top
Serge Paccalin
Guest





PostPosted: Thu May 19, 2005 10:25 am    Post subject: Re: VC++ 8 Pb Reply with quote



Le jeudi 19 mai 2005 à 11:37, korchkidu a écrit dans fr.comp.lang.c++ :

Quote:
ce programme ne compile pas sous VC++ 8:

int main()
{
vector<bool> vb;
vector<bool>::iterator it; // <-- COMPILATION ERROR
return 0;
}

quelqu'un pourrait m'expliquer pourquoi?

Le message d'erreur peut t'expliquer pourquoi. Et comme tu es le seul à
le connaître...

--
___________ 19/05/2005 12:24:24
_/ _ _`_`_`_) Serge PACCALIN -- sp ad mailclub.net
_L_) Il faut donc que les hommes commencent
-'(__) par n'être pas fanatiques pour mériter
_/___(_) la tolérance. -- Voltaire, 1763

Back to top
twxs
Guest





PostPosted: Thu May 19, 2005 11:50 am    Post subject: Re: VC++ 8 Pb Reply with quote



korchkidu wrote:
Quote:
Bonojour,

ce programme ne compile pas sous VC++ 8:

int main()
{
vector<bool> vb;
vector<bool>::iterator it; // <-- COMPILATION ERROR
return 0;
}

quelqu'un pourrait m'expliquer pourquoi?

Merci
K.

essaye avec :
typename vector
Twxs

Back to top
Cyrille
Guest





PostPosted: Thu May 19, 2005 1:19 pm    Post subject: Re: VC++ 8 Pb Reply with quote

korchkidu a écrit :
Quote:
Bonojour,

ce programme ne compile pas sous VC++ 8:

int main()
{
vector<bool> vb;
vector<bool>::iterator it; // <-- COMPILATION ERROR
return 0;
}

quelqu'un pourrait m'expliquer pourquoi?

Ca a l'air d'être un problème de l'implémentation du vector VC++. Le constructeur par défaut de la classe de base de l'itérateur
initialise un de ses membres à zéro et il y a une erreur de conversion.

Deux possibilités pour résoudre ton problème:
- corriger l'implémentation de vector<bool>
- ne rien corriger et initialiser ton iterator avec vb.begin().

Dans le premier cas, je crois avoir une solution: Tu vas à la ligne 1357
du fichier d'en-tête "vector", et tu remplaces la ligne
: _Myoff(0), _Myptr(0)
par
: _Myoff(0), _Myptr()
Je ne garantis pas que c'est sans danger, car je n'ai pas étudié à fond
tous les mécanismes de l'implémentation, mais à vue de nez ça devrait
aller. Si tu n'as pas envie de modifier l'implémentation sans trop
comprendre, et je te comprends, tu peux ne rien corriger et simplement
initialiser ton iterator avec vb.begin().

Une partie du message d'erreur pour ceux que ça intéresse:
d:program filesmicrosoft visual studio 8vcincludevector(1358) :
error C2664:
'std::_Vector_const_iterator<_Ty,_Alloc>::_Vector_const_iterator(const
std::_Vector_const_iterator<_Ty,_Alloc> &)' : cannot convert parameter 1
from 'int' to 'const std::_Vector_const_iterator<_Ty,_Alloc> &'
with
[
_Ty=std::_Vbase,
_Alloc=std::allocator<std::_Vbase>
]

Le code incriminé c'est:
class _Vb_iter_base
: public _Ranit<_Bool, _Dift, value_type *, value_type>
{ // store information common to reference and iterators
public:
// .....
_Vb_iter_base()
: _Myoff(0), _Myptr(0)
{ // construct with null pointer
}
// ......

size_type _Myoff;
_VbtypeIt _Myptr;


Plus haut:
typedef unsigned _Vbase; // word type for vector<bool>
// representation
typedef std::vector<_Vbase,
typename _Alloc::template rebind<_Vbase>::other>
_Vbtype;
typedef typename _Vbtype::const_iterator _VbtypeIt;

bref, il y a un iterateur du std::vector<> regulier qui est initialisé
avec 0 alors qu'il n'a pas de constructeur acceptant ce genre de valeur.
Il me semble que le constructeur par défaut est celui qui convient là,
car il répond à la même sémantique du constructeur de l'itérateur non
initialisé.

--
win the yes need the no to win against the no!

Back to top
David MAREC
Guest





PostPosted: Thu May 19, 2005 2:06 pm    Post subject: Re: VC++ 8 Pb Reply with quote

Cyrille a écrit :

Quote:
Ca a l'air d'être un problème de l'implémentation du vector<bool> par
VC++.

J'ignorais l'existence même d'une version 8 de Visual C++.

L'énoncé du problème a été porté sur <news:microsoft.public.vc.stl>.
- par un contributeur du présent groupe, je crois. -




Back to top
adebaene@club-internet.fr
Guest





PostPosted: Thu May 19, 2005 2:38 pm    Post subject: Re: VC++ 8 Pb Reply with quote


David MAREC a écrit :
Quote:
Cyrille a écrit :

Ca a l'air d'être un problème de l'implémentation du
vector<bool> par
VC++.

J'ignorais l'existence même d'une version 8 de Visual C++.

Aussi nommé Visual 2005, actuellement en Beta 2.


Quote:
L'énoncé du problème a été porté sur
news:microsoft.public.vc.stl>.
- par un contributeur du présent groupe, je crois. -

Oui, moi. C'est un problème connu et déjà corrigé (mais pas dans la
version Beta courante) :
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=36e876b7-0e4e-45ae-bd8c-313a8dd7aacf

Les risques à travailler avec une version Beta :-)

Arnaud


Back to top
kanze@gabi-soft.fr
Guest





PostPosted: Fri May 20, 2005 6:52 am    Post subject: Re: VC++ 8 Pb Reply with quote

twxs wrote:
Quote:
korchkidu wrote:

ce programme ne compile pas sous VC++ 8:

int main()
{
vector<bool> vb;
vector<bool>::iterator it; // <-- COMPILATION ERROR
return 0;
}

quelqu'un pourrait m'expliquer pourquoi?

essaye avec :
typename vector

Quel est l'équivalent français à : « stabbing in the dark » ? Ou
« just guessing » ?

Typename est parfois nécessaire dans un template, quand il
s'agit d'un nom dépendant. Je ne suis même pas sûr qu'il soit
légal en dehors d'un template ; il est certainement inutile
(parce qu'il y a pas de recherche dépendante en dehors d'un
template).

Et j'espère que tu montres un peu plus de rigueur dans le code
que tu écris que dans tes réponses ici.

--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34


Back to top
Pierre Lairez
Guest





PostPosted: Sat Jun 11, 2005 8:50 am    Post subject: Re: VC++ 8 Pb Reply with quote


Pour ceux que les bugs gènent de trop, il y a STLport. C'est très facile
d'intallation.

PS: J'ai été bluffé par VC8... J'avais essayé d'installer STLport et Boost
avec STLport, je n'ai pas réussi avec VC7.1, ni avec ICL8.1. Avec VC8 ça a
tout de suite marché, pas un seul warning. J'ai juste eu à bidouiller un
petit peu les fichier .jam, mais rien de bien compliqué.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.