Posts
 
Reputation
Joined
Last Seen
Ranked #41
Strength to Increase Rep
+16
Strength to Decrease Rep
-4
97% Quality Score
Upvotes Received
388
Posts with Upvotes
336
Upvoting Members
156
Downvotes Received
13
Posts with Downvotes
10
Downvoting Members
7
171 Commented Posts
~967.10K People Reached
Favorite Forums
Favorite Tags
Member Avatar for SHWOO

try posing your query in a directx forum. eg.[url]http://www.gamedev.net/community/forums/forum.asp?forum_id=10[/url]

Member Avatar for Pavel_11
0
311
Member Avatar for mnoizinum

the standard c++ library exposes only one name [ICODE]std[/ICODE] to the global namespace. everything else is put inside the namespace [ICODE]std[/ICODE]. change [ICODE]#include <iostream.h>[/ICODE] to [CODE]#include <iostream> using namespace std ;[/CODE] without the using directive, you need to qualify names with [ICODE]std::[/ICODE] ie. [ICODE]std::cout[/ICODE] etc.

Member Avatar for Dani
0
256
Member Avatar for ssharp77

you could also use the algorithm [ICODE]std::unique_copy[/ICODE]. [code=c++]#include <iostream> #include <fstream> #include <vector> #include <iterator> #include <algorithm> struct consecutive_blanks { bool operator() ( char first, char next ) const { return first==' ' && next==' ' ; } }; int main() { std::ifstream fin( "text_1.txt" ) ; fin >> std::noskipws …

Member Avatar for Dhushanthan
0
936
Member Avatar for vishalonne

Toggle a boolean flag, perhaps? const int arr[3][3] = { { 23, 54, 76 }, { 37, 19, 28 }, { 62, 13, 19 }, } ; bool alt = true ; for( const auto& row : arr ) for( int i : row ) { if(alt) std::cout << i …

Member Avatar for DIVYANSHI MANGAL
0
1K
Member Avatar for stefy14

#include <iostream> #include <locale> #include <iomanip> // http://en.cppreference.com/w/cpp/locale/numpunct struct space_separated : std::numpunct<char> { // http://en.cppreference.com/w/cpp/locale/numpunct/thousands_sep virtual char do_thousands_sep() const override { return ' ' ; } // separate with spaces // http://en.cppreference.com/w/cpp/locale/numpunct/grouping virtual std::string do_grouping() const override { return "\3"; } // in groups of 3 digits }; int main() …

Member Avatar for amisha_1
0
57K
Member Avatar for Agni

here are some references: [url]http://en.wikipedia.org/wiki/Performance_analysis[/url] [url]http://perfsuite.ncsa.uiuc.edu/[/url] [url]http://en.wikipedia.org/wiki/Valgrind[/url] [url]http://www.gnu.org/software/binutils/manual/gprof-2.9.1/html_mono/gprof.html[/url]

Member Avatar for Magee_1
0
3K
Member Avatar for doug65536

Use a Threadpool Cleanup Group to manage graceful shutdown. [url]http://msdn.microsoft.com/En-US/library/ms682036%28v=VS.85%29.aspx[/url]

Member Avatar for Klaus_1
0
556
Member Avatar for kylcrow

the basic problem here is that we need to select one item at random when we do not know beforehand how many items there are. the most common example of this in real code is when a random element has to be picked from a list (size unknown). there is …

Member Avatar for zia shaikh
0
5K
Member Avatar for MedianHansen

here is something obtained thru googling (i've no clue about either dev-c++ or sdl); see if these help. [url]http://www.gpwiki.org/index.php/C:How_to_set_up_your_SDL_Build_Environment#Windows:_Dev-C.2B.2B[/url] [url]http://www.imrtechnology.ngemu.com/sdldevtut.htm[/url] if they do not, abandon daniweb and try a forum where there may be people who are more knowledgable. eg. [url]http://gpwiki.org/forums/viewforum.php?f=2[/url]

Member Avatar for Slavik
0
6K
Member Avatar for .It.

[quote]I don't want others to edit my strings. It appears there's no easy solution for this, as I don't want any internet connection or such methods[/quote] Here's one (stand alone, without network etc.) way to do it; this might help to get you started. It assumes that all you are …

Member Avatar for overwraith
0
5K
Member Avatar for ddanbe

15. Use const proactively. Summary const is your friend. Immutable values are easier to understand, track, and reason about, so prefer constants over variables wherever it is sensible and make const your default choice when you define a value. It's safe, it's checked at compile time, and it's integrated with …

Member Avatar for ipswitch
0
435
Member Avatar for Anshu27

std::ofstream is not a *CopyConstructible* or *CopyAssignable* type. But it is MoveConstructible and MoveAssignable. The CopyConstructor is explicitly deleted. http://en.cppreference.com/w/cpp/io/basic_ofstream/basic_ofstream The CopyAssignment operator is implicitly deleted. http://en.cppreference.com/w/cpp/io/basic_ofstream/operator%3D The CopyAssignment operator of `routecaseBasedCDRFile` wold have been implicitly deleted if had not been declared. In this case, there is a user-defined CopyAssignment …

Member Avatar for Schol-R-LEA
0
757
Member Avatar for Ahmed91za

Trustworthy (and succinct) recommendations: http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list https://isocpp.org/get-started 'What is the best book to learn C++ from?' in https://isocpp.org/wiki/faq/how-to-learn-cpp

Member Avatar for vijayan121
0
169
Member Avatar for Hector3000

Use an *enumeration* http://en.cppreference.com/w/cpp/language/enum Something like: #include <iostream> #include <string> enum class choice_t : std::size_t { one = 1, two = 2 /* ... */, invalid = std::size_t(-1) }; std::ostream& operator << ( std::ostream& stm, choice_t c ) { std::cout << "choice_t::" ; static const std::string text[] = { "invalid", …

Member Avatar for vijayan121
0
190
Member Avatar for jamesjohnson25

This is an infinite loop: `for( int i = 0, n = 2; ; ++i ) { /* ... (no break statement) */ }` A missing condition makes the implied while clause equivalent to `while(true)`. At some point of time, when `i` becomes equal to `std::numeric_limits<int>::max()`, `++i` will cause a …

Member Avatar for vijayan121
0
514
Member Avatar for nitin1

Use *thread storage duration* for the singleton. http://en.cppreference.com/w/cpp/language/storage_duration struct A // per-thread singleton { static A& instance() ; private: A() { /* ... */ }; A( const A& ) = delete ; // non-copyable A( A&& ) = delete ; // non-moveable }; A& A::instance() // Meyer's singleton { thread_local …

Member Avatar for vijayan121
0
336
Member Avatar for nathan.pavlovsky

The keys in the map are const objects: `const std::string`; they can't be modified directly inside the map. Something like this, perhaps: #include <iostream> #include <map> #include <string> #include <cctype> std::string to_lower( const std::string& str ) { std::string lc ; for( char c : str ) lc += std::tolower(c) ; …

Member Avatar for nathan.pavlovsky
0
665
Member Avatar for tinsaea

Don't know about Turbo C++. This is standard C++; it may work in Turbo C++ too. // open the source file for input (text) std::ifstream srce_file( "G:/one/file.txt" ) ; // or "G:\\one\\file.txt" if it is a really old version of Windows // check for is_open() elided for brevity // open …

Member Avatar for vijayan121
0
256
Member Avatar for it@61@sec

`<cerrno>` defines several standard integer error codes (*integer constant expressions* with type `int`). For instance, ENOENT for 'No such file or directory' http://en.cppreference.com/w/cpp/error/errno_macros `<system_error>` gives us the *scoped enum* `std::errc` For instance, `std::errc::no_such_file_or_directory` http://en.cppreference.com/w/cpp/error/errc `<system_error>` also has the class `std::error_code`. Objects of this type can be created from an *error …

Member Avatar for vijayan121
0
214
Member Avatar for Curious Gorge

`ScheduleFile mySchedule();` This is the declaration of a nullary function returning a *prvalue* of type `ScheduleFile` See: https://en.wikipedia.org/wiki/Most_vexing_parse int main() { // ScheduleFile mySchedule(); // declare a function ScheduleFile mySchedule ; // define a default initialised object }

Member Avatar for Curious Gorge
0
319
Member Avatar for Kanoisa

The canonical C++ way is to use templated callbacks in conjunction with: wrapping the call in a polymorphic call wrapper `std::function<>` and currying with `std::bind()` http://en.cppreference.com/w/cpp/utility/functional/function http://en.cppreference.com/w/cpp/utility/functional/bind Sample code: http://coliru.stacked-crooked.com/a/8d4283e68de561cf http://rextester.com/VBNT79084

Member Avatar for Kanoisa
0
284
Member Avatar for nitin1

#include <iostream> #include <limits> #include <stdexcept> #include <algorithm> #include <cassert> // algorithm from 'Hacker's Delight' by Henry S. Warren // http://www.amazon.com/dp/0201914654 unsigned int plus( unsigned int a, unsigned int b ) { auto carry = a & b; auto sum = a ^ b; while( carry != 0 ) { …

Member Avatar for rubberman
0
163
Member Avatar for tnd2491

To search for a pattern in a string, use the C++ regular expression library. Tutorial: https://solarianprogrammer.com/2011/10/12/cpp-11-regex-tutorial/ http://www.informit.com/articles/article.aspx?p=2079020 The simplest way to run code asynchronously, and retrieve the result of the asynchronous operation, is to use `std::async()`. Tutorial: https://solarianprogrammer.com/2012/10/17/cpp-11-async-tutorial/ http://www.drdobbs.com/cpp/c11s-async-template/240001196 Once you have read up on these two, writing the code …

Member Avatar for vijayan121
0
178
Member Avatar for David_53

> compile error : no matching member function for call to 'insert' There is no error in the posted code (once the missing headers are added). Since C++11, `insert()` and `erase()` on standard constainers accept `const_iterators`. http://en.cppreference.com/w/cpp/container/vector/insert http://en.cppreference.com/w/cpp/container/vector/erase Note: this does not break legacy code. The IS requires that for …

Member Avatar for vijayan121
0
349
Member Avatar for nightcrew

An external merge sort using four files, perhaps? [url]http://en.wikipedia.org/wiki/Merge_sort#Use_with_tape_drives[/url]

Member Avatar for omgerg
0
3K
Member Avatar for Narue

> ...probably some gcc/g++ extension that was messing things up > (which is obviously the only real possibility here). it is not some gcc/g++ extension; it is POSIX [ICODE]man pause[/ICODE] [url]http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=pause(2[/url])

Member Avatar for Smn
18
13K
Member Avatar for Luisa_1

Book: The C++ Standard Library: A Tutorial and Reference (2nd Edition) by Josuttis http://www.amazon.com/Standard-Library-Tutorial-Reference-2nd/dp/0321623215 Online reference: http://en.cppreference.com/w/ Offline archive: http://en.cppreference.com/w/File:html_book_20141118.zip

Member Avatar for rubberman
0
176
Member Avatar for kungle

GNU specific, and worth studying merely for the elegance of the design. (Note: it violates ODR, but the implementation is allowed to provide well-defined semantics for undefined behaviour.) **<begion quote>** The following goals directed the design of the libstdc++ debug mode: Correctness: <...> Performance: <...> Usability: <...> **Minimize recompilation**: While …

Member Avatar for Maritimo
0
589
Member Avatar for aluhnev

> is it used to substitute constructor? Yes. An exception-safe and (usually) more efficient substitute. > This function is typically used to replace the construction `std::shared_ptr<T>(new T(args...))` of a shared pointer from the raw pointer returned by a call to new. > In contrast to that expression, `std::make_shared<T>` typically allocates …

Member Avatar for vijayan121
0
248
Member Avatar for aida.atef.31

#include <iostream> int main() { int x ; std::cin >> x ; // if input fails, x would be set to zero int y = 0 ; std::cin >> y ; // do nothing if std::cin is in a failed state // there is no need to check that x …

Member Avatar for vijayan121
0
251