Skip to content

Implement reverse iterators #209

@tfpf

Description

@tfpf

Template the view iterator (which is a forwards iterator) using the type of the underlying C++ iterator. Specialise it for the two possible types of C++ iterators (forwards and reverse).

Specialisation is demonstrated in the working example below.

#include <iostream>

template<typename T>
struct Stuff
{
    int foo(void);
};

template<typename T>
int Stuff<T>::foo(void)
{
    return 1;
}

template<>
int Stuff<long>::foo(void)
{
    return -1;
}

int main(void)
{
    std::cout << Stuff<long>().foo() << '\n';
    std::cout << Stuff<bool>().foo() << '\n';
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions