CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2005
    Posts
    41

    help about queue

    why this give error:
    {
    queue<char[4]> list;
    char temp[4];
    list.push( temp );
    temp = list.front();
    }

  2. #2
    Join Date
    Jun 2003
    Location
    Armenia, Yerevan
    Posts
    720

    Re: help about queue

    because the type of temp is constant pointer.

  3. #3
    Join Date
    Jul 2005
    Posts
    41

    Re: help about queue

    even if we take the line
    {
    temp - list.front();
    }there is still error..
    the error is in pushing line
    {
    list.push( temp );
    }

  4. #4
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: help about queue

    Well...simply because you cannot use arrays with the STL containers...simply use 'string' instead...
    Code:
    #include <queue>
    #include <string>
    
    std::queue<std::string> list;
    std::string s("Hello");
    list.push(s);
    std::string t = list.front();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured