My snippet of code:
void
RMWavefrontFileImporter::loadVertexIntoVector(
const std::vector<std:string> lineElements,
std::vector<const RM3DVertex>* vertices)
{
assert(vertices);
std::unique_ptr<const RM3DVertex> verticeRef = verticeWithElements(lineElements);
const RM3DVertex* vertex = vertexRef.get();
assert(vertex);
vertices->push_back(*vertex);
}
The error message I'm getting:
Cannot initialize a parameter of type 'void *' with an lvalue of type 'const RM3DVertice *'
I'm failing to see the problem. Is there anything obvious I'm missing?
The value type
T
of astd::vector<T>
needs to be CopyInsertible or MoveInsertible. To be either, it is necessary to call the moral equivalent ofWith
T
being aconst
type this doesn't work, e.g., because there is no conversion fromT*
tovoid*
ifT
is of the formX const
. You want to remove theconst
fromstd::vector<const RM3DVertice>
.