A few minor stylistic bits, adding to what other reviews already mentioned:
__RING_QUEUE_H__
include guard uses the double underscore prefix, which is reserved for implementation and Standard Library names. Refer to this SO question Refer to this SO question for a complete listing of potentially reserved named and prefixes.Technically,
size_t
is a member of namespace std in C++, e.g.:std::size_t
. It happens to exist in the global scope as well because most implementations use the same header file for both C and C++, so the C header exposes all types globally. This is not a requirement, however, so for better portability your should consider fully qualifying the name.~RingQueue(){}
: The empty destructor is not necessary. You only need to provide one if: the class needs some customized cleanup; if you need avirtual
destructor for inheritance; if you need to make the destructor private or protected. Otherwise, omit the declaration and let the compiler supply a default for you.inline
is not necessary when a class method is directly defined inside the class body in the header file. In this case, it serves no purpose but to make your code more verbose.I would personally use shorter lines. Put the method
ret name(parameters)
part in its own line, with the{ }
body on the next following lines.You might consider declaring functions as
noexcept
where applicable, if you plan on making this as Standard compliant as possible.max_size()
is aconstexpr
method instd::array
. It just returns some predefined constant. You can apply that to your wrapper method as well.
A few minor stylistic bits, adding to what other reviews already mentioned:
__RING_QUEUE_H__
include guard uses the double underscore prefix, which is reserved for implementation and Standard Library names. Refer to this SO question for a complete listing of potentially reserved named and prefixes.Technically,
size_t
is a member of namespace std in C++, e.g.:std::size_t
. It happens to exist in the global scope as well because most implementations use the same header file for both C and C++, so the C header exposes all types globally. This is not a requirement, however, so for better portability your should consider fully qualifying the name.~RingQueue(){}
: The empty destructor is not necessary. You only need to provide one if: the class needs some customized cleanup; if you need avirtual
destructor for inheritance; if you need to make the destructor private or protected. Otherwise, omit the declaration and let the compiler supply a default for you.inline
is not necessary when a class method is directly defined inside the class body in the header file. In this case, it serves no purpose but to make your code more verbose.I would personally use shorter lines. Put the method
ret name(parameters)
part in its own line, with the{ }
body on the next following lines.You might consider declaring functions as
noexcept
where applicable, if you plan on making this as Standard compliant as possible.max_size()
is aconstexpr
method instd::array
. It just returns some predefined constant. You can apply that to your wrapper method as well.
A few minor stylistic bits, adding to what other reviews already mentioned:
__RING_QUEUE_H__
include guard uses the double underscore prefix, which is reserved for implementation and Standard Library names. Refer to this SO question for a complete listing of potentially reserved named and prefixes.Technically,
size_t
is a member of namespace std in C++, e.g.:std::size_t
. It happens to exist in the global scope as well because most implementations use the same header file for both C and C++, so the C header exposes all types globally. This is not a requirement, however, so for better portability your should consider fully qualifying the name.~RingQueue(){}
: The empty destructor is not necessary. You only need to provide one if: the class needs some customized cleanup; if you need avirtual
destructor for inheritance; if you need to make the destructor private or protected. Otherwise, omit the declaration and let the compiler supply a default for you.inline
is not necessary when a class method is directly defined inside the class body in the header file. In this case, it serves no purpose but to make your code more verbose.I would personally use shorter lines. Put the method
ret name(parameters)
part in its own line, with the{ }
body on the next following lines.You might consider declaring functions as
noexcept
where applicable, if you plan on making this as Standard compliant as possible.max_size()
is aconstexpr
method instd::array
. It just returns some predefined constant. You can apply that to your wrapper method as well.
A few minor stylistic bits, adding to what other reviews already mentioned:
__RING_QUEUE_H__
include guard uses the double underscore prefix, which is reserved for implementation and Standard Library names. Refer to this SO question for a complete listing of potentially reserved named and prefixes.Technically,
size_t
is a member of namespace std in C++, e.g.:std::size_t
. It happens to exist in the global scope as well because most implementations use the same header file for both C and C++, so the C header exposes all types globally. Thought thisThis is not a requirement, however, so for better portability your should consider fully qualifying the name.~RingQueue(){}
: The empty destructor is not necessary. You only need to provide one if: the class doesneeds some customized cleanup; if you need avirtual
destructor for inheritance; if you need to make the destructor private or protected. Otherwise, omit the declaration and let the compiler supply a default for you.inline
is not necessary when a class method is directly defined inside the class body in the header file. In this case, it serves no purpose but to make your code more verbose.I would personally use shorter lines. Put the method
ret name(parameters)
part in its own line, with the{ }
body on the next following lines.You might consider declaring functions as
noexcept
where applicable, if you plan on making this as Standard compliant as possible.max_size()
is aconstexpr
method instd::array
. itIt just returns some predefined constant. You can apply that to your wrapper method as well.
A few minor stylistic bits, adding to what other reviews already mentioned:
__RING_QUEUE_H__
include guard uses the double underscore prefix, which is reserved for implementation and Standard Library names. Refer to this SO question for a complete listing of potentially reserved named and prefixes.Technically,
size_t
is a member of namespace std in C++, e.g.:std::size_t
. It happens to exist in the global scope as well because most implementations use the same header file for both C and C++, so the C header exposes all types globally. Thought this is not a requirement, so for better portability your should consider fully qualifying the name.~RingQueue(){}
: The empty destructor is not necessary. You only need to provide one if: the class does some customized cleanup; if you need avirtual
destructor for inheritance; if you need to make the destructor private or protected. Otherwise, omit the declaration and let the compiler supply a default for you.inline
is not necessary when a class method is directly defined inside the class body in the header file. In this case, it serves no purpose but to make your code more verbose.I would personally use shorter lines. Put the method
ret name(parameters)
part in its own line, with the{ }
body on the next following lines.You might consider declaring functions as
noexcept
where applicable, if you plan on making this as Standard compliant as possible.max_size()
is aconstexpr
method instd::array
. it just returns some predefined constant. You can apply that to your wrapper method as well.
A few minor stylistic bits, adding to what other reviews already mentioned:
__RING_QUEUE_H__
include guard uses the double underscore prefix, which is reserved for implementation and Standard Library names. Refer to this SO question for a complete listing of potentially reserved named and prefixes.Technically,
size_t
is a member of namespace std in C++, e.g.:std::size_t
. It happens to exist in the global scope as well because most implementations use the same header file for both C and C++, so the C header exposes all types globally. This is not a requirement, however, so for better portability your should consider fully qualifying the name.~RingQueue(){}
: The empty destructor is not necessary. You only need to provide one if: the class needs some customized cleanup; if you need avirtual
destructor for inheritance; if you need to make the destructor private or protected. Otherwise, omit the declaration and let the compiler supply a default for you.inline
is not necessary when a class method is directly defined inside the class body in the header file. In this case, it serves no purpose but to make your code more verbose.I would personally use shorter lines. Put the method
ret name(parameters)
part in its own line, with the{ }
body on the next following lines.You might consider declaring functions as
noexcept
where applicable, if you plan on making this as Standard compliant as possible.max_size()
is aconstexpr
method instd::array
. It just returns some predefined constant. You can apply that to your wrapper method as well.
A few minor stylistic bits, adding to what other reviews already mentioned:
__RING_QUEUE_H__
include guard uses the double underscore prefix, which is reserved for implementation and Standard Library names. Refer to this SO question for a complete listing of potentially reserved named and prefixes.Technically,
size_t
is a member of namespace std in C++, e.g.:std::size_t
. It happens to exist in the global scope as well because most implementations use the same header file for both C and C++, so the C header exposes all types globally. Thought this is not a requirement, so for better portability your should consider fully qualifying the name.~RingQueue(){}
: The empty destructor is not necessary. You only need to provide one if: the class does some customized cleanup; if you need avirtual
destructor for inheritance; if you need to make the destructor private or protected. Otherwise, omit the declaration and let the compiler supply a default for you.inline
is not necessary when a class method is directly defined inside the class body in the header file. In this case, it serves no purpose but to make your code more verbose.I would personally use shorter lines. Put the method
ret name(parameters)
part in its own line, with the{ }
body on the next following lines.You might consider declaring functions as
noexcept
where applicable, if you plan on making this as Standard compliant as possible.max_size()
is aconstexpr
method instd::array
. it just returns some predefined constant. You can apply that to your wrapper method as well.