exercism / exercism/website-copy

"We received the following error when we ran your code:" but no error is following

Aperta
#2,199 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
HTML
Stelle
217
Fork
944
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I'm on the site: https://exercism.org/tracks/cpp/exercises/circular-buffer/edit

My .hh source code is:

```
#if !defined(CIRCULAR_BUFFER_H)
#define CIRCULAR_BUFFER_H
#include
#include
using namespace std;
namespace circular_buffer {
template
class circular_buffer
{

public:
int pos=0;
int writepos=0;
int len=0;
vector elems;
int num;
circular_buffer(int num): elems(num)
{
num=num;
}

T read()
{
if (len==0)
throw domain_error("alma");
len--;
T ret= elems[pos];
pos=(pos+1)%num;
return ret;

}

void write(T a)
{
if (len==num)
throw domain_error("alma");
len++;


writepos=(writepos+1)%num;
elems[writepos]=a;


}

void clear()
{
len=0;

}

void overwrite(T a)
{
if (len==num)
{}
else
len++;


writepos=(writepos+1)%num;
elems[writepos]=a;


}

};

} // namespace circular_buffer

#endif // CIRCULAR_BUFFER_H
```

The .cc source code is the default

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.