简体   繁体   中英

C2248 - No access to private member when passing QScopedPointer to function

I´m getting the following error on this piece of code.

QScopedPointer<NoteEvent> onEvent(new NoteEvent(date, chan, pitch, vel, true));
QScopedPointer<NoteEvent> offEvent(new NoteEvent(date + dur, chan, pitch, vel, false));
Score::noteStream->addNoteEvent(onEvent);
Score::noteStream->addNoteEvent(offEvent);


void NoteStream::addNoteEvent(QScopedPointer<NoteEvent> noteEvent)
{
    noteEvents->push_back(noteEvent);
}

Error: C2248: "QScopedPointer": No access to private member declared in QScopedPointer

Reading through other posts was not helpful.

QScopedPointer doesn't have a public copy constructor. It cannot be passed around by value, nor stored in containers that require its elements to be copyable (which noteEvents might be, depending on how it's declared).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM