#if !defined( INCLUDED_CONTAINER_ARRAY_H )
#define INCLUDED_CONTAINER_ARRAY_H
+#include <vector>
+/// \todo remove the custom allocator
+#include "memory/allocator.h"
+template<typename Element, typename Allocator = DefaultAllocator<Element> >
+using Array = std::vector<Element, Allocator>;
+/// \todo replace Array<char> with std::string
+
+#if 0
#include <cstddef>
#include <algorithm>
self.swap( other );
}
}
+#endif
#endif
return false;
}
+template<typename Type, typename Other>
+inline bool operator!=( const DefaultAllocator<Type>&, const DefaultAllocator<Other>& ){
+ return false;
+}
+template<typename Type, typename OtherAllocator>
+inline bool operator!=( const DefaultAllocator<Type>&, const OtherAllocator& ){
+ return true;
+}
+
#endif
return false;
}
- for ( const_iterator i = m_ctrl.begin(); i != m_ctrl.end(); ++i )
+ for ( const auto& i : m_ctrl )
{
- if ( !float_valid( ( *i ).m_vertex.x() )
- || !float_valid( ( *i ).m_vertex.y() )
- || !float_valid( ( *i ).m_vertex.z() )
- || !float_valid( ( *i ).m_texcoord.x() )
- || !float_valid( ( *i ).m_texcoord.y() ) ) {
+ if ( !float_valid( i.m_vertex.x() )
+ || !float_valid( i.m_vertex.y() )
+ || !float_valid( i.m_vertex.z() )
+ || !float_valid( i.m_texcoord.x() )
+ || !float_valid( i.m_texcoord.y() ) ) {
globalErrorStream() << "patch has invalid control points\n";
return false;
}
return 0;
}
-typedef PatchControl* iterator;
-typedef const PatchControl* const_iterator;
+typedef PatchControlArray::iterator iterator;
+typedef PatchControlArray::const_iterator const_iterator;
iterator begin(){
- return m_ctrl.data();
+ return m_ctrl.begin();
}
const_iterator begin() const {
- return m_ctrl.data();
+ return m_ctrl.begin();
}
iterator end(){
- return m_ctrl.data() + m_ctrl.size();
+ return m_ctrl.end();
}
const_iterator end() const {
- return m_ctrl.data() + m_ctrl.size();
+ return m_ctrl.end();
}
PatchControlArray& getControlPoints(){
void transformComponents( const Matrix4& matrix ){
if ( selectedVertices() ) {
- PatchControlIter ctrl = m_patch.getControlPointsTransformed().begin();
+ PatchControlIter ctrl = m_patch.getControlPointsTransformed().data();
for ( PatchControlInstances::iterator i = m_ctrl_instances.begin(); i != m_ctrl_instances.end(); ++i, ++ctrl )
{
if ( ( *i ).m_selectable.isSelected() ) {
Array<char> log( log_length );
glGetInfoLogARB( object, log_length, &log_length, log.data() );
- globalErrorStream() << StringRange( log.begin(), log.begin() + log_length ) << "\n";
+ globalErrorStream() << StringRange( log.data(), log.data() + log_length ) << "\n";
}
void createShader( GLhandleARB program, const char* filename, GLenum type ){
};
-typedef FlatShadedVertex* FlatShadedVertexIterator;
+typedef Array<FlatShadedVertex>::iterator FlatShadedVertexIterator;
void Triangles_BestPoint( const Matrix4& local2view, clipcull_t cull, FlatShadedVertexIterator first, FlatShadedVertexIterator last, SelectionIntersection& best ){
for ( FlatShadedVertexIterator x( first ), y( first + 1 ), z( first + 2 ); x != last; x += 3, y += 3, z += 3 )
{