Questions tagged [c++03]

C++03 is an earlier revision of the C++ standard, with C++98 as its predecessor and C++11 as its successor.

Filter by
Sorted by
Tagged with
3
votes
2answers
54 views

Finding paths between triangles efficiently in 3D geometry #2

This post is an update of the one from here. I've updated the code and a couple pieces of the post itself. I've been writing some functions used to find paths between two types of triangles - alphas ...
3
votes
3answers
108 views

Finding paths between triangles efficiently in 3D geometry

An update to this post can be found here I've been writing some functions used to find paths between two types of triangles - alphas and betas. Alphas are triangles that have been in a zone we ...
5
votes
1answer
85 views

wrapper for common subset of auto_ptr and unique_ptr API

I read an interesting old question on the Software Engineering SE about how to transition away from std::auto_ptr. So I wrote a wrapper around the common subset of <...
1
vote
1answer
201 views

Using mutable keyword to implement an owner-pointer class (C++03)

For a couple of days, I have been trying to implement an own templated class called owner_ptr (for my little project) whose instances has ownership over a ...
5
votes
3answers
382 views

Inheriting from std::auto_ptr to support deletion of allocated arrays in C++98/C++03

[EDIT: Thanks for your opinions. I think this topic is discussed enough. Since std::auto_ptr is removed from C++17, I decided to drop the idea of inheriting from <...
3
votes
1answer
2k views

Functions asking for user input, with default prompts

I succeeded in the first part of the exercise, this attempt is the second part. I am not sure I have accomplished the goal, and would appreciate the input of more knowledgeable minds. As always, ...
1
vote
0answers
94 views

UVA: Y2K Accounting Bug

The Challenge Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc. All what they remember is that MS Inc. posted ...
1
vote
0answers
268 views

UVa 524 - Prime Ring

The challenge A ring is composed of n (even number) circles as shown in diagram. Put natural numbers 1,2,...,n into each circle separately, and the sum of numbers in two adjacent circles should be ...
8
votes
3answers
632 views

UVA 750: 8 Queens Chess

In chess it is possible to place eight queens on the board so that no one queen can be taken by any other. Write a program that will determine all such possible arrangements for eight queens given ...
3
votes
2answers
1k views

OrderedList class template

I called my template OrderedList, but I don't like the name. Is there a better one? It stores a vector of values of type T, and ...
2
votes
2answers
1k views

Simple class to mimic a dynamic array

for my c++ class I was asked to write a class with the following characteristics: Implement a vector replacement that operates only on integers (you don't need to use templates like the normal STL)...
1
vote
0answers
76 views

Pimpl helper class

I have started to utilize the PIMPL pattern in my code. I do not have access to C++11 etc. but do have access to Boost. The code must be able to compile on C++03 compilers. I decided to write a ...
2
votes
1answer
249 views

Memoization via template

This is kind of follow up of this question on stack overflow... I wrote the following to utilize memoization for functions that take a single parameter and return a value: ...
2
votes
2answers
286 views

Relaying stdin data from one thread to another

I'd like to know if this piece of code is thread-safe. I'm learning something about threads, queues and synchronization, and I'd like to make sure this is correct, before moving forward to next step. ...
4
votes
1answer
8k views

Converting a string to a list of key-value pairs

I'm trying to convert a string (here after called input) into a vector of key-value pairs, all in C++03 (cannot use C++11, cannot use Boost libs). The string in ...
4
votes
2answers
2k views

Portable C++98 thread class akin to std::thread

I want a homegrown version of C++11's std::thread. My motivation is to avoid manual memory management of the arguments passed to the thread function. I'm restricted ...
1
vote
0answers
37 views

IUnitTest, INonCopyable, and IMapKey mixins

I am creating a boiler-plate namespace that will allow me to ensure proper coding practices are followed and avoid gotchas. Looking over my code below; can you see any "no-no's" or gotchas? Can you ...
4
votes
1answer
123 views

Distance between angles as points

This code calculates the distance between angles, particularly for n-tuples of angles. One example where this situation occurs is as follows: I'm using a 2 arms, one 6 degree of freedom and the other ...
1
vote
0answers
29 views

Time calculation to identify current phase

I have a program that works by periodic phases, and I need to understand, depending on the current time, which phase should be executed. The following is not for busy wait, it's just a check. I'm ...
2
votes
1answer
36 views

Implement test which tries function with diferent params and expected results

What could I improve in the following code? The goal is to test a function againts a table of input parameters and compare to some expected results with some tolerance (as there are random variables ...
1
vote
1answer
619 views

Circular buffer offsets and sorted set of offsets sorted on their index

Consider the following C++03 code: ...
1
vote
1answer
1k views

Converting integers to strings

I drafted a method that I intend to use to convert integers to strings. Is there a way to make it faster? Are there any "simple" changes I could make to improve its performance? This cannot be done ...
8
votes
1answer
460 views

Member function state machine

For various reasons, I wrote this. For one, I don't like to wrap every single function in a separate class, which is too verbose. It's a state machine based on GoTW 57 function pointer wrapping and ...
2
votes
0answers
218 views

Length Conversions

I'm trying to create some helper functions that will allow me to convert from one unit of measurement to another. I eventually will need to be able to do speeds and temperatures as well, but so far, I'...
4
votes
3answers
157 views

Using a template to cycle through a sequence of containers

I'm trying to implement a template that takes a container as parameter. The template has a getnext method that cycles through the elements in the parameter. Take ...
5
votes
2answers
2k views

Fixed size matrix implementation

I implemented a fixed-size matrix class which supports basic matrix operations (cannot use C++11). What do you think, and how could it be improved? ...
5
votes
2answers
115 views

Avoiding casts in abstract types

I asked this question on Stack Overflow and in the comments someone had this to say. In a proper design, you should almost never have to do a dynamic_cast, even if it's hidden inside some nice ...
5
votes
1answer
693 views

Dijkstra's and Prim's algorithms: correctness/efficiency

This is in preparation for a competition that only allows C++03. ...
2
votes
1answer
826 views

RAII-style lockable objects

I am working on a Windows project using C++03 (C++11 is not an option), and without using Boost. I have several resources that are accessed by multiple threads at various times - a queue, for example, ...
3
votes
1answer
3k views

Using set for unordered, unique list of elements

In C++11 we have the option of using std::unordered_set if we require a list of elements that have no duplicates but order is not important. In C++03 we don't have ...
10
votes
2answers
1k views

make_auto implementation for C++03 compilers

I want to provide, in the the spirit of C++11/boost make_shared and C++14 make_unique, a production-ready make_auto for C++03 compilers. So, inspired boost's make_shared implementation for C++03 ...
3
votes
2answers
350 views

legacy code and exception handling

After some 'digging' into the dark corners of legacy code I've found class, which handles INI files. It does reading and writing to the file, but I haven't found any exception handling logic. What ...
2
votes
1answer
4k views

Standard library-like linear interpolation table

I'm looking for a general review of a generalized linear interpolation table. Design decisions, anything that's missing, anything that could be clearer or simplified, any style considerations. Keep in ...
9
votes
2answers
2k views

Custom nullptr_t class

I tried to write a nullptr_t class based on the official proposal to be used in C++03 only. The only differences with the proposal are that we can compare two ...
0
votes
2answers
485 views

Remove continuous duplicate

I've made a little function to eliminate continuous duplicate from a std::vector. I have to use C++03. For example, if a vector of ints is composed of: 1,1,2,3,,3,...