Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. STL list member function(S)

STL list member function(S)

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
4 Posts 3 Posters 0 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Amr Mohammad87
    wrote on last edited by
    #1

    void assign(size_type n, el const T& el = T()) This function is a member function of the STL list class and I do not understand the bolded part. I understand the const T& el is a reference to a constant parameter which means I cannot change the value/content of the passed argument + I understand that el = T() means a default parameter so if there is no argument passed in the calling function the el will use the no-argument constructor of the T() type OK. But what make me confused the el at the beginning before the const?!!! so if someone can fill the blank gaps for me I will be grateful :). Thanks in advance.

    C 1 Reply Last reply
    0
    • A Amr Mohammad87

      void assign(size_type n, el const T& el = T()) This function is a member function of the STL list class and I do not understand the bolded part. I understand the const T& el is a reference to a constant parameter which means I cannot change the value/content of the passed argument + I understand that el = T() means a default parameter so if there is no argument passed in the calling function the el will use the no-argument constructor of the T() type OK. But what make me confused the el at the beginning before the const?!!! so if someone can fill the blank gaps for me I will be grateful :). Thanks in advance.

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      which compiler are you using? i haven't been able to find any std::list::assign definitions that look like that. http://www.cplusplus.com/reference/list/list/assign/[^], for both C++98 and C++11, has

      void assign (size_type n, const value_type& val);

      MSVC 8.0 has the same. so does the current MSDN (https://msdn.microsoft.com/en-us/library/w3eba3dd.aspx?f=255&MSPPError=-2147217396[^])

      image processing toolkits | batch image processing

      A 1 Reply Last reply
      0
      • C Chris Losinger

        which compiler are you using? i haven't been able to find any std::list::assign definitions that look like that. http://www.cplusplus.com/reference/list/list/assign/[^], for both C++98 and C++11, has

        void assign (size_type n, const value_type& val);

        MSVC 8.0 has the same. so does the current MSDN (https://msdn.microsoft.com/en-us/library/w3eba3dd.aspx?f=255&MSPPError=-2147217396[^])

        image processing toolkits | batch image processing

        A Offline
        A Offline
        Amr Mohammad87
        wrote on last edited by
        #3

        I read it in a book called "Data Structures and Algorithms in C++, 4th Edition by Adam Drozdek" it was in chapter 3 "Linked Lists" at the beginning of page 110 :). It made me had the feeling of this :wtf: :confused::~ when read it, and after searching and find nothing I become like this ;P;P;P (i.e., psycho). Thanks by the way for reply :)

        CPalliniC 1 Reply Last reply
        0
        • A Amr Mohammad87

          I read it in a book called "Data Structures and Algorithms in C++, 4th Edition by Adam Drozdek" it was in chapter 3 "Linked Lists" at the beginning of page 110 :). It made me had the feeling of this :wtf: :confused::~ when read it, and after searching and find nothing I become like this ;P;P;P (i.e., psycho). Thanks by the way for reply :)

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          Looks like a typo, to me.

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups