Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Placing template in a QByteArray
QtWS25 Last Chance

Placing template in a QByteArray

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Forgive
    wrote on last edited by
    #1

    Let's take this as an example:

    @template<typename ...Parameters>
    void MyClass::MyFunction(Parameters&&... parameters)
    {
    QDataStream myDStream;
    }@

    I want to put the template stuff inside the QDataStream. How is possible to do this?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      For Qt standard variables there are alreday "output operators":https://qt-project.org/doc/qt-4.8/qdatastream.html#operator-lt-lt defined.
      Others you have to write your own overlayed output operators.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        Have a look into "this older thread":/forums/viewreply/22324/, there's a sample on how to write your own operator overloads for QDataStream.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Forgive
          wrote on last edited by
          #4

          Well, actually when doing myDStream << (parameters)... compiler cryes about the "..." but if i remove them, cryes about not having them.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            So... how did you declare and implement your QDataStream operator overloads?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved