[ת] C/C++ STL֮remove
http://www.cppreference.com/wiki/cn/stl/algorithm/remove
Óï·¨:
#include <algorithm>
forward_iterator remove( forward_iterator start, forward_iterator end, const TYPE& val );
remove Ëã·¨ÒƳý [start,end) ·¶Î§Ö®ÄÚµÄËùÓÐÓë val ÏàµÈµÄÔªËØ¡£
´Ëº¯ÊýµÄ·µ»ØÖµÊÇÒ»¸öµü´úÆ÷£¬ËüÖ¸Ïò²»°üº¬Óë val ÏàµÈµÄÔªËصÄÐÂÐòÁеÄ×îºóÒ»¸öÔªËصĺóÃæ¡£
×¢ÒâremoveµÄʵÏÖͨ³£²¢²»ÕæµÄ´Ó [start, end) ·¶Î§ÄÚÒƳýÔªËØ£»Èç¹ûÔÚÒ»¸öÈÝÆ÷ÉÏÃæµ÷ÓÃremove£¬ÔÚµ÷ÓÃÖ®ºó´ËÈÝÆ÷µÄ³¤¶È²¢²»»á·¢Éú¸Ä±ä£¨Ö»Í¨¹ýiterators£¬remove²¢²»ÄÜÓ°ÏìÈÝÆ÷µÄ³¤¶È£©£¬ËùÓÐÔªËØ»¹ÊÇÁôÔÚÈÝÆ÷ÄÚ¡£È»¶ø£¬remove½«ËùÓб» “removed” µÄÔªËØ·ÅÔÚÈÝÆ÷µÄβ²¿£¬È»ºó·µ»ØÒ»¸öÇø·Öδ±»É¾³ýºÍ±»É¾³ýÔªËصĵü´úÆ÷¡£ÎªÁË´ÓÒ»¸öÈÝÆ÷ɾ³ýÔªËØ£¬ÄãÓ¦¸Ãµ÷ÓôËÈÝÆ÷µÄ erase ·½·¨É¾³ý´Ó·µ»ØµÄµü´úÆ÷£¨iterator£©´¦¿ªÊ¼µÄÔªËØ¡£Õâͨ³£±»ÁªºÏÆðÀ´³Æ×÷£ºerase-remove idiom:
container.erase(remove(container.begin(), container.end(), val), container.end());
(container can be of type vector, string or deque)
remove º¯ÊýµÄʱ¼ä¸´ÔÓ¶ÈÊÇÏßÐԵģ¨linear time£©¡£
Ïà¹Ø»°Ì⣺remove_copy, remove_copy_if, remove_if, unique, unique_copy
Ïà¹ØÎĵµ£º
ÎÒ֮ǰÊÇÒ»¸öC³ÌÐòÔ±£¬¶øÇÒÊǸöWindowsµÄ³ÌÐòÔ±£¬ÔÚwindowsÏÂʹÓÃVC6.0/VS2005µÈmicrosoftµÄɵ¹Ïʽ¹¤¾ß¹¤×÷£¬
¶ÔÓÚÄǸövc 6.0/vs2005µÄ¿ì½Ý²Ù×÷£¬debug²Ù×÷ÊÇÄÇôµÄÊìϤ£¬¿ÉÒÔ˵vc
6.0/vs2005ÊÇwindowÏ¿ª·¢c/c++×îºÃÓõŤ¾ßÁË£¬¿ÉÒԲ鿴µ÷ÓöÑÕ»£¬ÄÚ´æ±ä»¯Çé¿ö£¬±äÁ¿Öµ£¬ÁíÍâ°²×° visual assist
xºóÈÃVC¿´ÆðÀ´ÊÇÄÇô ......
´î½¨eclipse C/C++¿ª·¢»·¾³£º
1¡¢ÏÂÔز¢°²×°Eclipse for C++£ºhttp://www.eclipse.org¡£×îаæÊÇ»ùÓÚEclipse 3.5 galileo£¬ÎļþÃûΪeclipse-cpp-galileo-SR1-win32.zip¡£É蹤×÷Ŀ¼ΪD:\workspace_cpp¡£
2¡¢eclipse for C/C++ IDEûÓаüº¬C/C++µÄ±àÒëÆ÷ºÍµ÷ÊÔÆ ......
×î½üÔÚÓÃC++±àдһ¸öRTSPµÄ¿Í»§¶Ë£¬ÓÉÓÚÒªÓõ½Ị̈߳¬¸ù¾ÝC±à³ÌµÄ¾Ñ飬дÁËÈçÏ´úÂ룺
class LiRtspSession
{
public:
void* MainThreadFunc(void* pvData);
void* AudioProcThreadFunc(void* pvData);
& ......
LinuxÏÂCºÍC++¿ª·¢»ù´¡
»ù±¾±à³Ì¸ÅÄî
n ±à³ÌÓïÑÔ£ºC ¡¢C++
n ±àÒë(compile)£ºÔ´Îļþ£¨.c£©->Ä¿±êÎļþ(.o)
n Á¬½Ó(link)£ºÄ¿±êÎļþ(.o)->¿ÉÖ´ÐÐÎļþ
n ¿â(library)£º¾²Ì¬Á¬½Ó¿â(.a)¡¢¶¯Ì¬Á¬½Ó¿â(.so)
LinuxÏ¿ª·¢¹¤¾ß
n±à¼Æ÷£ºvi¡¢emacs¡¢´°¿Ú±à¼Æ÷
n±àÒëÆ÷£ºGCC
nµ÷ÊÔÆ÷£ºGDB
n¿ÉÖ´ÐÐÎļþ¹¤¾ß£ ......
/*
* linux/kernel/floppy.c
*
* (C) 1991 Linus Torvalds
*/
/*
* 02.12.91 - Changed to static variables to indicate need for reset
* and recalibrate. This makes some things easier (output_byte reset
* checking etc), and means less i ......