Click here to Skip to main content
15,888,401 members
Everything / STL

STL

STL

Great Reads

by Thorsten Ottosen
Are you tired of filling data manually into STL containers? With the Initialization Library it gets a lot easier.
by Shmuel Zang
This article shows how we can implement a thread-safe events (similar to .NET events) mechanism using the standard C++ library.
by JadBenAutho
Efficient and standalone library for NTP server/client utilizing pure C++
by Michael Dunn
Create custom tasks in your app's jump list on Windows 7

Latest Articles

by JadBenAutho
Efficient and standalone library for NTP server/client utilizing pure C++
by Vadim Stadnik
Simple and useful alternative to traditional memory pool
by Steffen Ploetz
Is LINQ the right technology for processing large amounts of data in runtime-relevant environments?
by honey the codewitch
std::chrono doesn't work on the Teensy? Oh no! Here's how to fix it.

All Articles

Sort by Updated

STL 

9 Dec 2002 by #realJSOP
One technique for performing a binary insertion sort on a std::list
22 May 2022 by 0x01AA
Same here, ran the code without problems on https://www.onlinegdb.com/online_c++_compiler[^] /****************************************************************************** Online C++ Compiler. ...
3 May 2010 by 7mesho
Please I need help with this program. I am not getting proper result...(The program should find the longest symmetric sub-string and display it) Thanks for the help.#include #includeusing namespace std;char s[30];int i=0, j, first, last, length,subleng,...
3 Apr 2009 by _8086
union u{ char ch[2]; int i;};int main(){ union u x={0,2}; cout
26 Nov 2012 by __John_
You are calling UtilityHelper::MvResolutionInfoToVTVideoStandard(sResInfo) Using the type name "UtilityHelper" rather than calling the function from an instance of UtilityHelper.Only static functions can be called in this way (i.e. no instance required).
15 Aug 2004 by __PPS__
Shows how simple accessing Windows Registry can be if you do not need bells and whistles.
17 Sep 2013 by _Asif_
No there is no direct way because no body knows how struct information gets translated to vector. You need to put that transformation intelligence into the code to work. For examples check below linksOverloading conversion operator[^]Conversion Functions (C++)[^]
3 Apr 2012 by A. Ganzer
Did anyone of you ever use the messages facet of the STL and can help me?I Really don't know how to use this facet expediently. And it seems to me that no compiler does implement a suitable messages facet.Does anyone know a good tutorial for that?
8 Sep 2003 by Abbas_Riazi
Calculating Magic Square In Any Order Using Standard Template Library (STL)
12 Mar 2006 by Achilleas Margaritis
An easy way to provide expression-based callbacks in STL containers.
26 Nov 2010 by Achilleas Margaritis
C++0x Dynamic Message Passing Ala Objective-C
29 Jun 2012 by adityarao31
I want to learn STL library,I am new to it.Does STL is included in VC++ 6.0or I need to download.If I needed to download please let me know how to install it. I found on internet STL ,but it is just bunch of header files.Please Guide me for this.
29 Jun 2012 by adityarao31
My problem got solved after adding one lineusing namespace std;and by defining std::vector vec ,instead of vector vec
15 Jul 2002 by Adrian Bacaianu
That article present a way to retrieve the GET-POST data from a form into an ISAPI extension.
15 Jul 2002 by Adrian Bacaianu
This article presents a way to send cookies to client browser from an ISAPI extension.
9 Sep 2002 by Adrian Bacaianu
A good approach to build an ISAPI web application using XML and XSL
15 Jan 2006 by Adrian Bacaianu
 This article describes two ways to upload images and files on your web server, and the advantages and disadvantages of both.
28 May 2003 by adrian cooper
A beginner's guide to adding a binary resource in visual studio and a simple class for programmatical extraction.
27 May 2010 by Aescleal
If you're programming in C, then:strncpy( q, p, 499 );q[499] = '\0';will do the trick and work however long the string is. If you'd like to obfuscate things a bit more then you can combine the two lines into one by exploiting the return value of strncpy:strncpy( q, p, 499 )[ 499 ]...
1 Jun 2010 by Aescleal
1) Have a look in the source code of your compiler's version of the standard library.Having said that just because a particular version of the standard library does things one way doesn't mean that others can't do something radically different.2) If something has a comparison operator of...
15 Jun 2010 by Aescleal
If you want to store a bunch of elements unsorted may I humbly recommend using either std::vector (if you know roughly how many elements you're going to add) or std::list? Both of them provide a push_back function that'll preserve the insertion order for you.[Oh, and you'll have to find some...
23 Jun 2010 by Aescleal
When you copied the code did you just stick the code from std::sort into sort2 verbatim? i.e. sort2 isn't part of the std namespace. As it's not part of the std namespace it won't be using all the lovely specialisations for swap that are kicking around which may be the cause of the lack of...
27 Jul 2010 by Aescleal
Simple answer is don't clear it!priority_queues are designed to have stuff inserted in and sorted in priority order. They not designed to have stuff removed from them, well, except by yanking stuff off the front. If you want to clear it then bin the object and start again:q =...
16 Oct 2010 by Aescleal
If you're using C++ there's no reason to use printf or the whole god awful family of C relics. Use a stream. Then you get type safety and you won't try reading return addresses off the stack to interpret as strings. Consider rewriting along the lines of:int main(){ int d = 20; ...
13 Apr 2012 by Aescleal
It sounds like it would work, however without seeing the code I can't tell for sure. As you're a VC++ user perhaps download mingw (gcc for windows) and give it a whirl. If something compiles on VC++2005 or later and gcc 3.3 or later I'm usually happy it's standard code.Just to satisfy my...
13 Apr 2012 by Aescleal
The only compiler I've ever tried using message facets for is VC++ and I gave up on the idea when a colleague suggested something a bit simpler. It worked okay but was a bit clunky.However while battering my head against the wall of locales I found a couple of books really helpful. They...
2 Jun 2009 by agetina
I can read the prototypes for windows.h in the include folder (I have installed dev c++) but i want a list of explained functions. I don't know for what to use each of them.Thank you! modified on Wednesday, June 3, 2009 4:29 AM
16 Aug 2009 by Ahmed Charfeddine
?Thanks. Easy Profiler : a compile-time profiler for C++www.potatosoftware.commodified on Sunday, August 16, 2009 5:41 PM
14 Nov 2009 by Ahmed Charfeddine
Easily instrument your code, visualize, interpret results, track optimization, compare and decide.
23 May 2012 by Ahmed Charfeddine
Write asynchronous, multithreaded servers in a few lines of code. Monitor realtime activity with a deploy-only dashboard.
9 Jan 2010 by Ajay Vijayvargiya
Since Windows Vista supports "India' English", and has the following definition:0x4009 India (IN) 0x10 SUBLANG_ENGLISH_INDIA Visual Studio takes this as the project's language.While creating new project, one should select 'English (US)' as 'Resource Language' in Project Wizard.
12 Apr 2010 by Ajay Vijayvargiya
More of practical situations to use multithreading!
11 Nov 2010 by Ajay Vijayvargiya
Learn about parallel algorithms, parallel containers, tasks, task groups, agents library, task scheduler etc in VC10
28 Sep 2010 by Ajay Vijayvargiya
Reveals the important changes in STL.
16 Oct 2010 by Ajay Vijayvargiya
Perform Code Analysis with your code with /analyze switch with your Visual C++ compiler. You need to have Team System or the Ultimate version to do that.
10 Jan 2011 by Ajay Vijayvargiya
1 Jul 2012 by Ajay Vijayvargiya
Let's dwell deeper into C++ templates!
24 Jan 2011 by Ajay Vijayvargiya
Learn how you can write your own Windows debugger.
1 Jun 2010 by AkashAg
Hi All,I have some questions in mind about map and multimap. I know that STL use height-balanced-binary-search tree for MAP implementation but what is actually used for multimap.multimap can also use the same thing with a list in each node for a key. Am I right?How do I give a iterator...
28 Sep 2006 by Alain Rist
Plug-in CodeProject's CStdString as WTL::CString and get the WTL CString support with a Standard C++ Library implementation.
24 Nov 2010 by Alain Rist
Hi, Jim,The two operators have different return types.- operator tClassOneVect() { return m_MyData; } constructs a temporary tClassOneVect from m_MyData (using tClassOneVect copy constructor) and returns it: caller can do anything on the returned copy, it will not change the...
13 Dec 2010 by Alain Rist
Hi Ted,Not really understanding why you want to expose that, anyhow this should compile: typename std::deque::iterator begin(){ return B.begin();}cheers,AR
23 May 2011 by Alain Rist
Hi,std::list elements must be equality comparable. Add an operator == () to your struct mem_list like:struct mem_list{ bool operator == (const mem_list& other) { return (addr == other.addr) && (size == other.size); } unsigned int addr; int...
1 Jun 2011 by Alain Rist
This should do it, keeping the original std::pair functionality:struct MyPair : std::pair{ typedef std::pair Pair; int & something; int & somethingelse; MyPair() : something(Pair::first), somethingelse(Pair::second) {} MyPair(const...
16 Aug 2017 by Alasdair Craig
A C++ implementation of a published algorithm for computing the concave hull using a k-nearest neighbour approach.
31 May 2004 by Albert Wang
An article on XML parser or code generation automatically.
25 Feb 2004 by Alberto Bar-Noy
A simple reminder tool to remind you of your overdue tasks in ToDoList throughout the day
14 Apr 2021 by Aleh Baradzenka
The control representing a regular ToolBar in the form of a tree of command buttons
22 May 2008 by Alex C. Punnen
The Command Pattern and Chain of Responsibility for implementing a plug-in Thread Pool library.
25 Feb 2008 by Alex Cohn
XML parser helper classes in pure C++ without validation
19 Mar 2002 by Alex Mikunov
.NET Extensions that provide an infrastructure for enforcing database-like data integrity constraints
24 May 2000 by Alex Turc
Build a grid using ATL, STL and Win32 API.
13 Nov 2002 by Alex Vinokur
The program enables to get performance of C/C++ program and separated pieces of code for any metrics.
12 Nov 2002 by Alex Vinokur
The algorithm allows any kind of weights (costs, frequencies), including non-numerical ones
12 Nov 2002 by Alex Vinokur
The C++-program simulates a Turing Machine (TM). TM is defined by input files: metafile, states file, alphabet file, transition file, input word(s) file(s).
31 Aug 2004 by alex.barylski
A multiline hyper edit control derived from CEdit.
5 Sep 2001 by Alexander Berthold
Fast tokenizer for C++ - like 'lexx'
1 Jan 2002 by Alexander Berthold
A library allowing you to conveniently build a custom tokenizer and analyzer supporting precedence priorized rules
18 Oct 2013 by Alexander Fedorov
What would be an equvalent of CMapWordToPtr in modern STL? Is it unordered_map or just map or somethig else is better?
12 Jan 2002 by Alexander Kovachev
Simple class to represent tree data structures in C++
15 Jun 2012 by AlexZakharenko
A more efficient way to create objects for usage with shared_ptr
19 Nov 2013 by Ali AslRousta
How to implement a generic lazy evaluation class using C++11 features.
23 May 2014 by AlwaysLearningNewStuff
I am trying to remove all spaces from a string, therefore I wrote a small helper function to do it.When tested in a basic program, everything works fine. In my more complex project it malfunctions. Furthermore, when I type std::re autocomplete offers proper replace but as soon as I type (...
24 May 2014 by AlwaysLearningNewStuff
I have successfully populated linked list with data from a text file. Linked list contains structure that has 5 fields of type string.I wish to sort the list by a certain structure field ( ascending or descending ). I have decided to overload operator
13 Jul 2009 by amatecki
The article describes how to use the Microsoft's UPnP Control Point API for finding and controlling UPnP devices, and includes a description of simple library to facilitate the application of Control Point API in your own programs, together with an example of MFC and WinForms applications.
14 Nov 2003 by Amer Gerzic
Explains principles behind writing regular expression parsers.
21 Mar 2016 by ameyakoshti
Hello I am doing computer engineering and i needed some guidanceregarding my project.1st of all i want to know whether it is possible to disable usb portsand CD rom "POWER" through VC++.If yes then could you please guide me on it?Thanks
29 Aug 2006 by amonlee
for some novice of STL, like me, who might make some low level errors when trying to release memory
6 Jan 2003 by anandaji
This article shows how we can use caching while performing insert, edit and update functions in the DataGrid.
22 Dec 2012 by Anders Dalvander
An introduction to context handles in RPC. A simple RPC client/server application using context handles is explained.
22 Dec 2012 by Anders Dalvander
An introduction to RPC programming. A simple RPC client/server application is explained.
8 Aug 2007 by Andre Ladeira
A class to create a NT service with a few lines of code
27 Jan 2013 by Andreas Gieriet
There is not such thing like "the one and only code convention".Your team/company may/may not decide on some code convention.If no explicit convention is given, anyone does whatever he thinks is the right way (or does not care at all...).Naming conventions, layouting, etc. is very much...
7 Mar 2006 by Andreas Loeffler
How to use and develop plug-ins for multiple platforms.
15 May 2002 by Andreas Saurwein
3 simple classes for easy retrival of running processes, modules and threads
3 Mar 2003 by Andreas Saurwein
Template based file and directory enumeration class.
20 Feb 2003 by Andreas Saurwein
Simple tool to test applications under various memory conditions.
7 Apr 2012 by AndreFratelli
Hello everyone,I have the following hierarchy:std::map ->assoc_map ->_tActionMap_tActionMap maps actions (Action) with moods (Mood). The problem is: Mood has an intensity value which is mandatory, so there is no default constructor, and I don't want one.Now, templates only...
11 Apr 2012 by AndreFratelli
Hello everyone,I just saw this in the STL implementation source:template inline _Ty _FARQ *_Allocate(_SIZT _Count, _Ty _FARQ *) { // check for integer overflow if (_Count
20 Feb 2009 by Andrew McAuley
Hi there,I'm new to C++ and i've got a basic project i've made up, just to play around with templates. It consists of the following classes: - enumerable (used much like IEnumerable in .NEt Framework code) - list [inherits from enumerable]...
6 Jul 2003 by Andrew Walker
An overview of the Boost library
10 May 2009 by Andriy Tylychko
A single header cross-platform thread-safe logging facility
3 Nov 2003 by Andy Brummer
These iterators provide a simple way to sample or stretch a fixed size data set to fit in a larger or smaller container
5 May 2010 by Andy Melville
Hi AllIf you use the following to find the size of a file and then effectively read every character of the file until the end of the file: long begin, end, size; ifstream myfile ("example.txt"); begin = myfile.tellg(); myfile.seekg (0, ios::end); end = myfile.tellg(); ...
22 Dec 2008 by Anem Mahesh
Open your resource script file, and delete this part from it://///////////////////////////////////////////////////////////////////////////// English (U.S.) (unknown sub-lang: 0x10) resources#if !defined(AFX_RESOURCE_DLL) ||...
9 Oct 2006 by Aniruddha Jahagirdar
The STL Serialization Library can serialize and load STL objects from a file. The serialization file format can be customised to suit your needs. It's fast, easy, and free!
18 Dec 2009 by Anirudh Kishan
Just imagine how your arguments would be passed.If it is passed as 1.2 and 2.2 to the (int,int) function then it would to truncated to 1 and 2.If it is passed as 1.2 and 2.2 to the (float,float) it will be processed as is.So here is where the ambiguity creeps in.I have found two...
19 May 2011 by ankitjoshi24
I found a way to disable the CD ROM using regedit. Now I am not sure how you can use it in VC++ but you can atleast havea look at the way of disabling it through regeditTo Disable CD-RomHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CDRomDouble Click on AutoRun and change the value...
18 Feb 2010 by annarao
class a{public void dis(){System.out.println("no argument");}public void dis(int i){System.out.println("one argument");}public void dis(int i,int j){System.out.println("two argument");}class maindemo{public static void main(String aggs[]){a=obj=new...
17 Feb 2012 by Anruin
Hello everyone!I've faced some weird stuff about STL containers - vectors and maps. My program is reading the binary file, that consist of data chunks. For every chunk object in memory is created and added to the vector (also I've tried maps). Like this:while ( nCurrentOffset
16 Dec 2012 by Anthony656
Is there a function to convert a vector to STL string in C++?I'm looking for something similar to a split/join type of functions available in other languages to split and join arrays.
6 Mar 2005 by AntonGogolev
14 Apr 2004 by AntonGogolev
A set of currency manipulation classes
5 Feb 2005 by AntonGogolev
27 May 2010 by Anu Koshy
strcpy(q,p); works fine.but if(strlen(p)>500)then strncpy(q, p, 499);q[500-1] = '\0';q has to be terminated with '\0'
31 May 2010 by Anu Koshy
if it is a text control, set "No Prefix" as True.That should solve the problem. :)
27 Jan 2009 by arad.moradi
i don't know what is the reason of of error.i write it with c++ & i send what is it about.it is the code:#include #include #include using namespace std;class cart{public: cart(char a[2]="paq"){ cout
30 Jun 2003 by Arnaud Brejeon
This article provides an easy way to load and save the parameters of an application in XML format.
1 Jun 2011 by ARopo
Could you use inheritence class MyPair : private std::pair { public: void SetMyFirstValue(int value) { first=value; } void SetMySecondValue(int value) { second=value; } int GetMyFirstValue() { return first; } int GetMySecondValue() { return second; } ...
1 Jun 2008 by Artem Kustikov
This article describes portable networking library (ahttp) and small HTTP server - result of modern C++ programming approaches investigation