Replace Boost usage with C++11 features

- Adds 'std=c++11' compiler flags
 - Replaces boost::type_traits with std::type_traits
 - Replaces boost::shared_ptr with std::shared_ptr
 - Replaces std::auto_ptr with std::unique_ptr
 - Replaces raw pointers with std::unique_ptr in ptr_vector, ptr_stack, and SettingChanges
 - Replaces boost::noncopyable with deleted copy and assignment operators
 - Replaces boost::next with std::next
 - Replaces boost::enable_if with std::enable_if
 - Replaces boost::is_convertible with std::is_convertible
 - Replaces ptrdiff_t with std::ptrdiff_t
 - Replaces boost::iterator_facade and boost::iterator_adaptor with std::iterator, borrowing the 'proxy reference' technique from boost
 - Removes Boost dependency from CMakeLists
 - Formats changed files using clang-format
This commit is contained in:
Matt Blair
2015-04-27 16:58:38 -04:00
parent 4376ebacaa
commit 24fa1b3380
19 changed files with 160 additions and 107 deletions

View File

@@ -124,10 +124,14 @@ void EmitterState::StartedGroup(GroupType::value type) {
const int lastGroupIndent = (m_groups.empty() ? 0 : m_groups.top().indent);
m_curIndent += lastGroupIndent;
std::auto_ptr<Group> pGroup(new Group(type));
// TODO: Create move constructors for settings types to simplify transfer
std::unique_ptr<Group> pGroup(new Group(type));
// transfer settings (which last until this group is done)
pGroup->modifiedSettings = m_modifiedSettings;
//
// NB: if pGroup->modifiedSettings == m_modifiedSettings,
// m_modifiedSettings is not changed!
pGroup->modifiedSettings = std::move(m_modifiedSettings);
// set up group
if (GetFlowType(type) == Block)
@@ -136,7 +140,7 @@ void EmitterState::StartedGroup(GroupType::value type) {
pGroup->flowType = FlowType::Flow;
pGroup->indent = GetIndent();
m_groups.push(pGroup);
m_groups.push(std::move(pGroup));
}
void EmitterState::EndedGroup(GroupType::value type) {
@@ -149,7 +153,7 @@ void EmitterState::EndedGroup(GroupType::value type) {
// get rid of the current group
{
std::auto_ptr<Group> pFinishedGroup = m_groups.pop();
std::unique_ptr<Group> pFinishedGroup = m_groups.pop();
if (pFinishedGroup->type != type)
return SetError(ErrorMsg::UNMATCHED_GROUP_TAG);
}