Skip to content

Commit

Permalink
Use final specifier instead of make_final, update type_traits.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Nov 3, 2015
1 parent 68ccea9 commit dbb05c0
Show file tree
Hide file tree
Showing 34 changed files with 50 additions and 252 deletions.
3 changes: 2 additions & 1 deletion src/common/object_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
////////////////////////////////////////////////////////////////////////////

#pragma once
#include <type_traits>

template <class M, typename P>
struct CLoader {
Expand All @@ -16,7 +17,7 @@ struct CLoader {
template <bool a>
IC static void load_data(T &data, M &stream, const P &p)
{
STATIC_CHECK (!is_polymorphic<T>::result,Cannot_load_polymorphic_classes_as_binary_data);
STATIC_CHECK (!std::is_polymorphic<T>::value,Cannot_load_polymorphic_classes_as_binary_data);
stream.r (&data,sizeof(T));
}

Expand Down
3 changes: 2 additions & 1 deletion src/common/object_saver.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
////////////////////////////////////////////////////////////////////////////

#pragma once
#include <type_traits>

template <class M, typename P>
struct CSaver {
Expand All @@ -16,7 +17,7 @@ struct CSaver {
template <bool a>
IC static void save_data(const T &data, M &stream, const P &p)
{
STATIC_CHECK (!is_polymorphic<T>::result,Cannot_save_polymorphic_classes_as_binary_data);
STATIC_CHECK (!std::is_polymorphic<T>::value,Cannot_save_polymorphic_classes_as_binary_data);
stream.w (&data,sizeof(T));
}

Expand Down
4 changes: 2 additions & 2 deletions src/common/object_type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@

enum {
value =
is_class<T1>::result &&
is_class<T2>::result &&
std::is_class<T1>::value &&
std::is_class<T2>::value &&
!is_same<T1,T2>::value &&
sizeof(detail::yes) == sizeof(select((T2*)(0)))
};
Expand Down
2 changes: 1 addition & 1 deletion src/xrCDB/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ IC void cdelete (T* &ptr)
{
if (ptr)
{
cspecial_free<is_polymorphic<T>::result,T>()(ptr);
cspecial_free<std::is_polymorphic<T>::value,T>()(ptr);
ptr = NULL;
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/xrCore/_stl_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using std::swap;

#include "_type_traits.h"

#ifdef __BORLANDC__
#define M_NOSTDCONTAINERS_EXT
#endif
Expand Down
62 changes: 0 additions & 62 deletions src/xrCore/_type_traits.h

This file was deleted.

1 change: 0 additions & 1 deletion src/xrCore/xrCore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,6 @@
<ClInclude Include="_std_extensions.h" />
<ClInclude Include="_stl_extensions.h" />
<ClInclude Include="_types.h" />
<ClInclude Include="_type_traits.h" />
<ClInclude Include="_vector2.h" />
<ClInclude Include="_vector3d.h" />
<ClInclude Include="_vector3d_ext.h" />
Expand Down
3 changes: 0 additions & 3 deletions src/xrCore/xrCore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,6 @@
<ClInclude Include="_stl_extensions.h">
<Filter>Math\Extensions</Filter>
</ClInclude>
<ClInclude Include="_type_traits.h">
<Filter>Math\Extensions</Filter>
</ClInclude>
<ClInclude Include="clsid.h">
<Filter>Math\Extensions</Filter>
</ClInclude>
Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/xrMemory_subst_msvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ IC void xr_delete(T*& ptr)
{
if (ptr)
{
xr_special_free<is_polymorphic<T>::result, T>()(ptr);
xr_special_free<std::is_polymorphic<T>::value, T>()(ptr);
ptr = NULL;
}
}
Expand All @@ -177,7 +177,7 @@ IC void xr_delete(T* const& ptr)
{
if (ptr)
{
xr_special_free<is_polymorphic<T>::result, T>(ptr);
xr_special_free<std::is_polymorphic<T>::value, T>(ptr);
const_cast<T*&>(ptr) = NULL;
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/xrGame/cover_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,9 @@ namespace smart_cover {
void CCoverManager::remove_nearby_covers (smart_cover::cover const &cover, smart_cover::object const &object) const
{
m_nearest.clear ();
typedef smart_cover::description::Loopholes::const_iterator const_iterator;
const_iterator I = cover.loopholes().begin();
const_iterator E = cover.loopholes().end();
for ( ; I != E; ++I ) {
Fvector position = cover.fov_position(**I);
for (const smart_cover::loophole *loophole : cover.loopholes())
{
Fvector position = cover.fov_position(*loophole);
m_covers->nearest (position, object.Radius() + 1.f, m_nearest);

m_nearest.erase(
Expand Down
44 changes: 0 additions & 44 deletions src/xrGame/debug_make_final.hpp

This file was deleted.

28 changes: 0 additions & 28 deletions src/xrGame/debug_make_final_test.cpp

This file was deleted.

3 changes: 1 addition & 2 deletions src/xrGame/smart_cover.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ struct loophole_data {
u32 m_level_vertex_id;
};

class cover :
class cover final :
public CCoverPoint,
private debug::make_final<cover>,
private boost::noncopyable
{
public:
Expand Down
5 changes: 1 addition & 4 deletions src/xrGame/smart_cover_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
#include "xrScriptEngine/script_space_forward.hpp"
#include "ai_monster_space.h"
#include "xrCore/Containers/AssociativeVector.hpp"
#include "debug_make_final.hpp"

namespace smart_cover{

class action :
private debug::make_final<action>,
private boost::noncopyable
class action final : private boost::noncopyable
{
private:
class animation_predicate {
Expand Down
6 changes: 2 additions & 4 deletions src/xrGame/smart_cover_animation_planner.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "smart_cover_detail.h"
#include "action_planner_script.h"
#include "stalker_decision_space.h"
#include "debug_make_final.hpp"

class CAI_Stalker;
struct SHit;
Expand All @@ -23,10 +22,9 @@ namespace smart_cover {
class cover;
class target_selector;

class animation_planner :
class animation_planner final :
public CActionPlannerScript<CAI_Stalker>,
private boost::noncopyable,
private debug::make_final<animation_planner>
private boost::noncopyable
{
private:
typedef CActionPlannerScript<CAI_Stalker> inherited;
Expand Down
4 changes: 1 addition & 3 deletions src/xrGame/smart_cover_animation_selector.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ namespace smart_cover {
class action_base;
class wait_after_exit;

class animation_selector :
private boost::noncopyable,
private debug::make_final<animation_selector>
class animation_selector final : private boost::noncopyable
{
private:
CPropertyStorage *m_storage;
Expand Down
6 changes: 2 additions & 4 deletions src/xrGame/smart_cover_default_behaviour_planner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
#include <boost/noncopyable.hpp>
#include "smart_cover_detail.h"
#include "action_planner_action.h"
#include "debug_make_final.hpp"

namespace smart_cover {

class animation_planner;

class default_behaviour_planner :
class default_behaviour_planner final :
public CActionPlannerAction<animation_planner>,
private boost::noncopyable,
private debug::make_final<default_behaviour_planner>
private boost::noncopyable
{
private:
typedef CActionPlannerAction<animation_planner> inherited;
Expand Down
4 changes: 1 addition & 3 deletions src/xrGame/smart_cover_description.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <boost/noncopyable.hpp>
#include "smart_cover_detail.h"
#include "graph_abstract.h"
#include "debug_make_final.hpp"

namespace smart_cover {

Expand All @@ -22,8 +21,7 @@ namespace transitions {
class action;
}

class description :
private debug::make_final<description>,
class description final :
private boost::noncopyable,
public detail::intrusive_base_time
{
Expand Down
4 changes: 1 addition & 3 deletions src/xrGame/smart_cover_loophole.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ namespace smart_cover {

class object;

class loophole :
private debug::make_final<loophole>,
private boost::noncopyable
class loophole final : private boost::noncopyable
{
private:
class action_predicate {
Expand Down
12 changes: 3 additions & 9 deletions src/xrGame/smart_cover_loophole_planner_actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ class loophole_action_no_sight : public loophole_action {
virtual void finalize ();
}; // class loophole_action_no_sight

class loophole_lookout :
public loophole_action,
private debug::make_final<loophole_lookout>
class loophole_lookout final : public loophole_action
{
private:
typedef loophole_action inherited;
Expand All @@ -88,9 +86,7 @@ class loophole_lookout :
virtual void finalize ();
};

class loophole_fire :
public loophole_action,
private debug::make_final<loophole_fire>
class loophole_fire final : public loophole_action
{
private:
typedef loophole_action inherited;
Expand All @@ -110,9 +106,7 @@ class loophole_fire :
virtual void on_no_mark ();
};

class loophole_reload :
public loophole_action_no_sight,
private debug::make_final<loophole_reload>
class loophole_reload final : public loophole_action_no_sight
{
private:
typedef loophole_action_no_sight inherited;
Expand Down
Loading

0 comments on commit dbb05c0

Please sign in to comment.