Question: I need help with some guides and reference to this TO-DO question(Code in C++): Concatenate the right hand side media list of media

I need help with some guides and reference to this "TO-DO" question(Code in C++):

Concatenate the right hand side media list of media items to this list by repeatedly inserting at the bottom of this medialist. The input type is a container of media items accessible with iterators like all the other containers. The constructor above gives an example. Use MediaList::insert() to insert at the bottom.

I need help with some guides and reference to this "TO-DO" question(Code

in C++): Concatenate the right hand side media list of media items

MeditList.hpp

#pragma once // include guard

#include

#include // size_t

#include

#include

#include

#include // domain_error, length_error

#include

#include

#include

#include "MediaItem.hpp"

class MediaList

{

// Insertion and Extraction Operators

friend std::ostream & operator

friend std::istream & operator>>( std::istream & stream, MediaList & mediaList );

// Relational Operators

friend bool operator==( const MediaList & lhs, const MediaList & rhs );

friend bool operator

public:

// Types and Exceptions

enum class Position {TOP, BOTTOM};

struct InvalidInternalState_Ex : std::domain_error { using domain_error::domain_error; }; // Thrown if internal data structures become inconsistent with each other

struct CapacityExceeded_Ex : std::length_error { using length_error::length_error; }; // Thrown if more items are inserted than will fit

struct InvalidOffset_Ex : std::logic_error { using logic_error ::logic_error; }; // Thrown of inserting beyond current size

// Constructors, destructor, and assignment operators

MediaList(); // construct an empty media list

MediaList( const MediaList & other ); // construct a media list as a copy of another media list

MediaList( MediaList && other ); // construct a media list by taking the contents of another media list

MediaList & operator=( MediaList rhs ); // intentionally passed by value and not const ref

MediaList & operator=( MediaList && rhs );

MediaList ( const std::initializer_list & initList ); // constructs a media list from a braced list of media items

MediaList & operator+=( const std::initializer_list & rhs ); // concatenates a braced list of media items to this list

MediaList & operator+=( const MediaList & rhs ); // concatenates the rhs list to the end of this list

~MediaList();

// Queries

std::size_t size() const;

std::size_t find( const MediaItem & item ) const; // returns the (zero-based) offset from top of list

// returns the (zero-based) position of the item, size() if item not found

// Mutators

void insert( const MediaItem & item, Position position = Position::TOP ); // add the media item to the top (beginning) of the media list

void insert( const MediaItem & item, std::size_t offsetFromTop ); // inserts before the existing item currently at that offset

void remove( const MediaItem & item ); // no change occurs if item not found

void remove( std::size_t offsetFromTop ); // no change occurs if (zero-based) offsetFromTop >= size()

void moveToTop( const MediaItem & item );

void swap( MediaList & rhs ) noexcept; // exchange one media list with another

private:

// Helper functions

bool containersAreConsistant() const;

std::size_t media_sl_list_size() const; // std::forward_list doesn't maintain size, so calculate it on demand

// Instance Attributes

std::size_t _media_array_size = 0; // std::array's size is constant so manage that attributes ourself

std::array _media_array;

std::vector _media_vector;

std::list _media_dl_list;

std::forward_list _media_sl_list;

};

// Relational Operators

bool operator==( const MediaList & lhs, const MediaList & rhs );

bool operator!=( const MediaList & lhs, const MediaList & rhs );

bool operator

bool operator

bool operator> ( const MediaList & lhs, const MediaList & rhs );

bool operator>=( const MediaList & lhs, const MediaList & rhs );

MediaList::Medialist( const std::initializer_list & initList ) : _media_vector ( initList.begin(), initList.end() ), _media_dl_list( initList.begin(), initList.end() ), _media_sl_list( initlist.begin(), initList.end()) { // Unlike the other containers that are expandable, the array has a fixed capacity N. Copy only the first N elements of the // initialization list into the array. for( auto p = initList.begin(); _media_array_size & rhs) IITTI TO-DO //// II Concatenate the right hand side media list of media items to this list by repeatedly inserting at the bottom of this /// media list. The input type is a container of media items accessible with iterators like all the other containers. The /// constructor above gives an example. Use Medialist::insert() to insert at the bottom. // Verify the internal media list state is still consistent amongst the four containers if( !containersAreConsistant()) throw Medialist:: InvalidInternalState_Ex( "Container consistency error" exception_location); return *this; Groceryltem GroceryList Public: Groceryltem() movie Title(): string director(): string studioName(): string run Time(): int (+Mutators) Public: GroceryList() find(): size_t insert(): void move To Top(): void operator+=(): GroceryList& remove(): void size(): size_t Private: _movie Title: string director: string _studioName: string _run Time: int Private: media_array: array _media_array_size: size_t media_dl_list: list _media_sl_list: forward_list media_vector: vector

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!