Program Listing for File get_parent_ids.hpp

Return to documentation for file (fwdpp/ts/get_parent_ids.hpp)

#ifndef FWDPP_TS_GET_PARENT_IDS_HPP
#define FWDPP_TS_GET_PARENT_IDS_HPP

#include <utility>
#include "definitions.hpp"

namespace fwdpp
{
    namespace ts
    {
        inline std::pair<table_index_t, table_index_t>
        get_parent_ids(const table_index_t first_parental_index,
                       const table_index_t parent, const int did_swap)
        {
            return std::make_pair(
                first_parental_index + 2 * static_cast<table_index_t>(parent)
                    + did_swap,
                first_parental_index + 2 * static_cast<table_index_t>(parent)
                    + !did_swap);
        }
    } // namespace ts
} // namespace fwdpp

#endif