Skip to content
Snippets Groups Projects
Commit 6c6a116b authored by Federico's avatar Federico
Browse files

More IntrusiveList error checks

parent 2831bee6
No related branches found
No related tags found
2 merge requests!40Update to Miosix 2.7,!17Draft: Improved miosix build system and fixed cmake scripts
......@@ -872,12 +872,26 @@ public:
/**
* \return a pointer to the first item. List must not be empty
*/
T* front() { return static_cast<T*>(IntrusiveListBase::front()); }
T* front()
{
auto result=IntrusiveListBase::front();
#ifdef INTRUSIVE_LIST_ERROR_CHECK
if(result==nullptr) fail();
#endif //INTRUSIVE_LIST_ERROR_CHECK
return static_cast<T*>(result);
}
/**
* \return a pointer to the last item. List must not be empty
*/
T* back() { return static_cast<T*>(IntrusiveListBase::back()); }
T* back()
{
auto result=IntrusiveListBase::back();
#ifdef INTRUSIVE_LIST_ERROR_CHECK
if(result==nullptr) fail();
#endif //INTRUSIVE_LIST_ERROR_CHECK
return static_cast<T*>(result);
}
/**
* \return true if the list is empty
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment