1
return Graph_iterator_Vertex(Vertexs.begin()); 

I do not understand why this line is called the copy constructor, although there is my constructor with a parameter. The arguments constructor parameter written specifically for this design. All that I have found about a similar issue is the use of typename. But it did not solve my problem.

struct Graph_iterator_Vertex
    {
    private:
        typename std::vector<Vertex<Type_Of_Value_Vertex, Type_Of_Value_Edge>>::iterator iterator;

    public:

        Graph_iterator_Vertex(typename std::_Vector_const_iterator<std::vector<Vertex<Type_Of_Value_Vertex, Type_Of_Value_Edge>>> iterator_)

        {
            iterator=iterator_
        }
    };

    const Graph_iterator_Vertex begin(void) const 
    {
        return Graph_iterator_Vertex(Vertexs.begin()); 
    }

where

std::vector<Vertex<Type_Of_Value_Vertex, Type_Of_Value_Edge>> Vertexs;

Error:

error C2440: <function-style-cast>: can not be converted std::_Vector_const_iterator<_Myvec>"in "Graph<Type_Of_Value_Vertex,Type_Of_Value_Edge>::Graph_iterator_Vertex" 
ggoha
  • 1,996
  • 3
  • 23
  • 31
  • 1
    Know the difference between `iterator` and `const_iterator`. Also know what `const` member function (such as `begin` in your code) does to the member data (such as `Vertexs`; note it changes it const-ness!) . – Nawaz Oct 14 '13 at 16:54

1 Answers1

1

you should use

std::vector<Vertex<Type_Of_Value_Vertex, Type_Of_Value_Edge>>::const_iterator

instead of

std::_Vector_const_iterator<std::vector<Vertex<Type_Of_Value_Vertex, Type_Of_Value_Edge>>>

as the type of your function parameter.

Zac Wrangler
  • 1,445
  • 9
  • 8