Search Result

Collapse
6 results in 0.0041 seconds.
Keywords
Members
Tags
stl
  •  

  • osfreak
    started a topic Priority Queue,Using custom compare function
    in C

    Priority Queue,Using custom compare function

    Code:
    #include<queue>
    #include<iostream>
    using namespace std;
    class CA
    {
    public:
    	CA(int parm,int pri):data(parm),priority(pri)
    	{}
    	CA()
    	{}
    
    	
    	bool operator < (CA rhs)
    	{
    		return data < rhs.GetData();
    	}
    
    	bool pricheck (const CA rhs)
    	{
    		return priority < rhs.GetPriority();
    	}
    ...
    See more | Go to post

  • How Complier Distinguish Between const_iterator begin() and iterator begin()

    Hello All,

    I have a very basic question on STL Iterator implementation, I like to know :

    How does complier distinguish between const_iterator begin() and iterator begin().

    There are few answer's on the internet but nothing concrete. I can't find exact, might be using wrong keywords in search.

    Can someone point out it, if possible with example.

    Many Thanks
    See more | Go to post

  • sankaran1984
    started a topic C++ - Single Linked List - Ideas
    in C

    C++ - Single Linked List - Ideas

    I want to write a method to remove consecutive items with duplicate data values from a singly linked list. The method should return the number of items removed. The method should clean up memory as required, and should assume that memory was allocated using new.

    For example, passing in the list
    ->a->b->c->c->a->b->b->b->a->null
    should result in
    ->a->b->c->a->b->a->null...
    See more | Go to post

  • sankaran1984
    started a topic C++ Coding Logic - Various Ideas
    in C

    C++ Coding Logic - Various Ideas

    I want to write a method to determine if a given string is a palindrome. E.g. "Madam I'm Adam", or "A man, a plan, a canal, Panama".

    The prototype for the function is:
    Code:
    bool is_palindrome(char const * str)
    I have a simple logic to check for equality by moving forward & backward from extreme ends of the string.
    But, i would like to know how many efficient ways to do...
    See more | Go to post

  • hagdanan
    started a topic STL map.find problem in using a compare class
    in C

    STL map.find problem in using a compare class

    Hi all, I am new to STL and I have a problem with my map. I made a class(Sort) for comparison on the map but the problem is map.find will not work.

    Can someone explain why find was not able to locate the key?

    here is the code:
    Code:
    #include<iostream>
    #include<map>
    #include<string>
    
    using namespace std;
    class Sort
    {
        public:
            bool
    ...
    See more | Go to post
    Last edited by Banfa; Apr 28 '10, 08:26 AM. Reason: Added [code]...[/code] tags

  • C++ STL to generate HTML for vertically alphabetized table

    presented for editing and comment

    The article is about using STL components in processing data and producing a <table> with the elements sorted vertically. The ideas in the program demonstrating STL use are interesting IMHO and the generation of vertically sorted tables is useful for some applications.

    /s/ Jim WIlliams

    Both files use UNIX line termination

    The article text is in HTML...
    See more | Go to post
    Last edited by Niheel; Sep 1 '24, 06:20 PM.
Working...