[Bf-committers] CVS commit: blender/intern/bsp/intern BSP_CSGMesh.cpp

Gilles J. Seguin bf-committers@blender.org
Mon, 30 Dec 2002 02:34:01 -0500


This is a multi-part message in MIME format.
--------------887AF06ED7973B89B4EEB41B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Unprivileged User wrote:
> 
> nobody      2002/12/29 16:59:52 CET
> 
>   Modified files:
>     blender/intern/bsp/intern BSP_CSGMesh.cpp
> 
>   Log:
>   While building with gcc on Irix one is confronted by the message:
> 
>   ---------------------------->8-----------------------------------
>   g++ -DHAVE_CONFIG_H -I. -I../../../blender/intern/bsp -I../..
> -I../../../blender/intern/container -I../../../blender/intern/moto/include
> -I../../../blender/intern/memutil -I/usr/freeware/include -g 
>- funsigned-char -c ../../../blender/intern/bsp/intern/BSP_CSGMesh.cpp
> -MT BSP_CSGMesh.lo -MD -MP -MF .deps/BSP_CSGMesh.TPlo  -DPIC 
> -o .libs/BSP_CSGMesh.lo
> /usr/freeware/lib/gcc-lib/mips-sgi-irix6.5/3.0.4/include/
>g++/bits/stl_iterator.h: In
>      constructor `std::__normal_iterator<_Iterator,
>      _Container>::__normal_iterator(const std::__normal_iterator<_Iter,
>      _Container>&) [with _Iter = const BSP_MFace*, _Iterator = BSP_MFace*,
>      _Container = std::vector<BSP_MFace, std::allocator<BSP_MFace> >]':
>   ../../../blender/intern/bsp/intern/BSP_CSGMesh.cpp:270:   
> instantiated from here
>   /usr/freeware/lib/gcc-lib/mips-sgi-irix6.5/3.0.4/include/
>g++/bits/stl_iterator.h:474: cannot
>      convert `const BSP_MFace* const' to `BSP_MFace*' in initialization
>   *** Error code 1 (bu21)
>   *** Error code 1 (bu21)
>   *** Error code 1 (bu21)
>   *** Error code 1 (bu21)
>   ---------------------------->8----------------------------------------------
> 
>   The line in question that causes the error is the middle one in this group:
> 
>         vector<BSP_MFace>::const_iterator f_it_end = FaceSet().end();
>         vector<BSP_MFace>::const_iterator f_it_begin = FaceSet().begin();
>         vector<BSP_MFace>::iterator f_it = FaceSet().begin();
> 
>   Dropping the 'const_' from that middle line enables gcc to compile the
>   file correctly (this is also consistent with what is going on with other
>   parts of the file, i.e., stuff that is returned from a begin() method is
>   declared as vector<BSP_MFace>::iterator instead of
>   vector<BSP_MFace>::const_iterator.
> 
>   But I'll be honest: I have no idea what this code does, so if somebody with
>   better C++ skills wants to check it, then please do.

// According to the resolution of DR179 not only the various comparison
// operators but also operator- must accept mixed iterator/const_iterator
// parameters.

try to used base() or template function distance() to resolve your
headers problems.

>   This change was also tested to compile and run on debian linux/x86
>   (well, booleans are broken right now, so I wasn't able to do too much
>   testing).
> 
>   Chris
> 
>   Revision  Changes    Path
>   1.4       +852 -852  blender/intern/bsp/intern/BSP_CSGMesh.cpp
              ---------
                  |
                  +--->  that was a big commit
--------------887AF06ED7973B89B4EEB41B
Content-Type: text/plain; charset=us-ascii;
 name="toto.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="toto.diff"

Index: blender/intern/bsp/intern/BSP_CSGMesh.cpp
===================================================================
RCS file: /cvs01/blender/intern/bsp/intern/BSP_CSGMesh.cpp,v
retrieving revision 1.4
diff -u -r1.4 BSP_CSGMesh.cpp
--- blender/intern/bsp/intern/BSP_CSGMesh.cpp	29 Dec 2002 15:59:51 -0000	1.4
+++ blender/intern/bsp/intern/BSP_CSGMesh.cpp	30 Dec 2002 07:30:20 -0000
@@ -156,8 +156,6 @@
 
 	if (verts == NULL || num_verts <3) return;
 
-	const int vertex_num = m_verts->size();
-
 	// make a polyscone from these vertex indices.
 
 	const BSP_FaceInd fi = m_faces->size();
@@ -203,7 +201,6 @@
 ){
 	// This creates a new polygon on the end of the face list.
 
-	const BSP_FaceInd fi = m_faces->size();
 	m_faces->push_back(BSP_MFace());			
 	BSP_MFace & face = m_faces->back();
 
@@ -251,11 +248,9 @@
 	//edges
 	
 	vector<BSP_MFace>::const_iterator f_it_end = FaceSet().end();
-	vector<BSP_MFace>::iterator f_it_begin = FaceSet().begin();
+	vector<BSP_MFace>::const_iterator f_it_begin = FaceSet().begin();
 	vector<BSP_MFace>::iterator f_it = FaceSet().begin();
 
-	vector<BSP_MVertex> & vertex_set = VertexSet();
-
 	vector<BSP_EdgeInd> dummy;
 
 	for (;f_it != f_it_end; ++f_it) {
@@ -267,7 +262,11 @@
 
 		for (int vert = 0; vert < vertex_num; ++vert) {
 
+#ifdef HAVE_DR179_BUG 
+			BSP_FaceInd fi(f_it - f_it_begin.base() );
+#else
 			BSP_FaceInd fi(f_it - f_it_begin);
+#if
 			InsertEdge(prev_vi,face.m_verts[vert],fi,dummy);
 			prev_vi = face.m_verts[vert];
 		}

--------------887AF06ED7973B89B4EEB41B--