fast I/O in C/C++

There many ways to do input/output in C/C++. Some are slow, some are fast and some can be very fast. Here I’ll be discussing some of these methods.Many a times during competetive programming you come across the warning “Careful – large input/output“. Now what exactly does this means? This basically means that you have to…

Read more...

C++: incomplete type and cannot be defined

A very confusing error just now: error: aggregate ‘std::ofstream out’ has incomplete type and cannot be definedfrom simple code: std::ofstream out;And the similar one: error: variable ‘std::ofstream out’ has initialiser but incomplete typefrom this code: std::ofstream out(fname.c_str(),std::ios_base::app);Using this didn’t help: #include <iostream>Using this also didn’t help: #include <ofstream>That was confusing me most, but now I…

Read more...

Memory profiling in C++

Code profiling as said in the earlier post is the dynamic analysis of resources used by a program or a small section of it.Here we will discuss about monitoring the memory during a run of a C++ program. Monitoring the memory greatly helps in optimizing your code. Memory leaks (when memory is not released back…

Read more...

Code Profiling for time in C++

Code profiling is a very important aspect of programming. First you must be wondering what is code profiling. You can always google it but in simple words “code profiling” is just measuring of the resources used by your program or small sections of your program.Here I will be talking about code profiling for “time”. Dynamically…

Read more...