代码拉取完成,页面将自动刷新
#ifndef _LIBRARY_H_
#define _LIBRARY_H_
#include<fstream>
#include<vector>
#include<set>
#include<stdexcept>
#include<algorithm>
#include"book.h"
namespace lib{
class Library{
public:
const std::set<Book> &books;
static std::string new_id(size_t);
Library():books(m_books){}
explicit Library(std::ifstream&);
// it may throw an exception - type is logic_error
void lend(const std::string &id,const std::string &name){
using namespace std;
lend(string(id),string(name));
}
void lend(const std::string &id,std::string &&name){
using namespace std;
lend(string(id),name);
}
void lend(std::string &&id,const std::string &name){
using namespace std;
lend(id,string(name));
}
void lend(std::string &&id,std::string &&name){
Book book(id,name);
if(m_books.find(book)!=m_books.end())
throw std::logic_error("lib::Library::lend:the ID is used");
m_books.insert(book);
}
// it may throw an exception - type is out_of_range
void Return(const std::string &id){
Return(std::string(id));
}
void Return(std::string&&);
std::vector<Book> sort_by_time()const;
void save(std::ofstream&)const;
private:
std::set<Book> m_books;
};
}
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。