Linked Questions
12 questions linked to/from infix_iterator code
14
votes
6
answers
16k
views
In-place reversal of a singly linked list
As suggested in The 2nd Monitor, I'd like a review of this in-place reversal of a singly linked-list:
...
4
votes
6
answers
9k
views
Elegantly exclude part of an operation for the last iteration in a loop [closed]
I'm afraid just about everybody who read this question has misunderstood it. I'm not trying to find the best way of printing a vector. I'm trying to find the best way of excluding part of an operation ...
7
votes
5
answers
1k
views
Convert sequence of number into display string
My requirement is to convert a sequence of numbers into a display string as below.
Example
Input
1,2,3,4,5,7,7,8,8,8,10,15,10,11,12,88,87,86
Output
1-5,7-8,10-12,15,86-88
...
5
votes
4
answers
2k
views
Google Code Jam - reverse words
As a sequel from my previous question, I decided to solve the next problem statement from the GCJ dash board. Any thorough critique, this time, with much attention to skill and technicalities would ...
3
votes
3
answers
875
views
Simple randomization program
I'm a few months into learning C++ programming and I want to know if I'm moving generally in the right direction or not with the following code. This is the most advanced thing I've created so far, ...
7
votes
2
answers
3k
views
Building a simple singly-linked list in C++11
The implementation below works, but I'm wondering if there's a modern C++ alternative.
For example:
Should I replace the raw new with a braced initializer?
Should ...
7
votes
1
answer
12k
views
Writing a vector to a file
The following function (function template rather) is to take a vector of any type and write it a file using a filestream object.
...
7
votes
3
answers
307
views
Summing up ints in vectors for education
To get started with C++11/14/17, I decided to write a program that brute forces the problem described in this video (and gives a progress update every few seconds):
Divide the numbers [0, 31] into ...
2
votes
3
answers
4k
views
Implementation of templated Doubly Linked List class in c++
The code below is my implementation of Templated Doubly Linked List in C++. I would be much obliged if you review my code and give me pointers on where and how I can improve the code. Thanks in ...
7
votes
2
answers
959
views
Selecting function overload based on a type match with return value of passed callable
On an std::list<A> or std::vector<A> or other collection container, the functor map (fmap) operation takes a ...
4
votes
1
answer
2k
views
Simplifying and optimizing factors and prime factorization generator
My first algorithm for finding the factors of a number was pretty slow and horrible (it started at \$O(n^2)\$, where n was not even the inputted number), but I eventually came up with this new code. ...
3
votes
2
answers
1k
views
Formatting seconds as days hours minutes seconds
I have the below and it gives me the desired output (ie; 1 day 12:05:33) but it looks overly complicated, is there a more straight forward way of doing this with the least amount of string ...