This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef SALES_DATA_H | |
#define SALES_DATA_H | |
#include <string> | |
#include <iostream> | |
class Sales_data { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SearchBook.hpp" | |
double Sales_data::avg_price () const { | |
return units_sold / revenue; | |
} | |
Sales_data &Sales_data::operator += (const Sales_data &lhs) { | |
units_sold += lhs.units_sold; | |
revenue += lhs.revenue; | |
return *this; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> /// std::cout | |
#include <cstdlib> /// #EXIT_SUCCESS --> macro definition | |
template <typename T> | |
T sum (const T &t1, const T &t2) { | |
return t1 + t2; | |
} | |
///******** template specializations of <T> sum ******************/// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
/** | |
@ C++ Primer 5th edition exercise 16.51: | |
@Author: Kryssel Tillada | |
@File : Memory.hpp | |
@Date : 10 / 17 / 15 | |
@@ note : if pragma macro does not work define your own header guard | |
@ added createResource tmp for allocating resource for smart_ptr tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> /// std::cerr | |
#include <cstdlib> /// #EXIT_SUCCESS | |
template <typename T> | |
void errorMsg (const T &t) { | |
std::cerr << t << std::endl; /// this template function will be called when the size of the pack is 1 because this function | |
} /// is the best match for the call because of its exactly one argument and is a more specialized function | |
template <typename T, typename ...Tv> /// template parameter pack expands its list of elements that deduced from template arguments and applies a pattern to the corresponding function parameter pack | |
void errorMsg (const T &t1, const Tv &...tv) { /// that is each element has const & Tv whatever type had deduced |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main () | |
{ | |
int sz = 0, unalloc_space = 1; | |
int *elem, input = 0, *alloc_mem = nullptr, *temp_mem; | |
while (std::cin >> input) { | |
if (alloc_mem == nullptr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
template <typename defType> | |
class defDeleter { | |
public: | |
void operator () (defType *); | |
private: | |
bool setState; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <memory> | |
#include <vector> | |
template <typename> class Vec; | |
template <typename getType> | |
bool operator == (const Vec <getType> &, const Vec <getType> &); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <iostream> | |
template <unsigned, unsigned> class ScreenTemplate; | |
template <unsigned getH, unsigned getW> | |
std::ostream &operator << (std::ostream &, const ScreenTemplate <getH, getW> &); | |
template <unsigned getH, unsigned getW> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef STORAGE_HEADER | |
#define STORAGE_HEADER | |
#include <memory> | |
#include <vector> | |
template <typename> class ptrStorage; | |
template <typename> class Storage; | |
template <typename getType> |