rexylib/rexy/binary.cpp
2020-03-02 16:35:52 -08:00

38 lines
1.1 KiB
C++

/**
This file is a part of rexy's general purpose library
Copyright (C) 2020 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "binary.hpp"
namespace rexy{
binary_base::binary_base(binary_base&& b):
m_data(std::exchange(b.m_data, nullptr)),
m_size(b.m_size),
m_cap(b.m_cap){}
char* binary_base::release(void){
return std::exchange(m_data, nullptr);
}
char& binary_base::operator[](size_t i){
return m_data[i];
}
const char& binary_base::operator[](size_t i)const{
return m_data[i];
}
}