Skip to content

Unique_ptr based Linked List implementation for reference

License

Notifications You must be signed in to change notification settings

agauniyal/smartList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smartList

Unique_ptr based Linked List implementation for reference

#include <iostream>
#include "include/smartList.hpp"

using std::cout;

const auto print = [](const auto N) { cout << N << ' '; };

int main()
{
    SmartList<int> list;
    std::cout << std::boolalpha << list.size() << ' ' << list.empty() << '\n';
    list.push_back({ 2, 1, 1, 3, 4, 5 });
    list.push_back(6);
    list.forEach(print);
    cout << '\n';
    std::cout << std::boolalpha << list.size() << ' ' << list.empty() << '\n';

    std::cout << "At index 0: " << list.value_at(0).value() << '\n';

    list.remove(1);
    list.forEach(print);
    cout << '\n';

    list.forEach([](auto &num) { num *= 10; });
    list.forEach(print);
    cout << '\n';

    list.reverse();
    list.forEach(print);
    cout << '\n';

    std::cout << "At index 4: " << list.value_at(4).value() << '\n';
}

About

Unique_ptr based Linked List implementation for reference

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages