Implement the pep::intrusive_list class template that supports the functionalities specified in the provided test code. The intrusive list should operate similarly to a standard doubly-linked list but with memory management handled through intrusive nodes linked directly to the objects that are stored within the list.
Specific Requirements:
Node Structure:
Each element stored in the intrusive_list should contain a member of type pep::intrusive_node for linking.
Class Definitions:
Define the pep::intrusive_list class template with the following template parameters:
T: The type of the elements stored in the list.
NodePtr: A pointer to the node structure used for linking.
Implement the following member types:
value_type: should be T.
reference: should be T&.
const_reference: should be const T&.
size_type: should be an unsigned integer type for size representation.
difference_type: should be a signed integer type.
Member Functions:
Implement the following public member functions:
bool empty() const: Returns true if the list is empty.
void push_back(T& element): Adds an element to the end of the list.
void push_front(T& element): Adds an element to the front of the list.
void pop_front(): Removes the element at the front of the list.
void pop_back(): Removes the element at the back of the list.
T& front(): Returns a reference to the first element in the list.
T& back(): Returns a reference to the last element in the list.
Iterator Support:
Implement basic iterators (begin(), end(), etc.) to allow iteration over the list using range-based for loops, std::for_each, and other standard algorithms.
Destructor:
Implement a destructor that ensures all nodes are properly unlinked and cleaned up when the list goes out of scope.
Move Semantics:
Implement move constructor and move assignment operator to allow efficient transfer of list ownership without deep copying the elements.
Your implementation must allow all the provided test cases to pass, especially regarding element management (linking and unlinking) and iterator functionality. Place your solution in the /app/ directory.