Skip to content

Commit

Permalink
Moves safe_cast<> into separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
kpp committed May 11, 2017
1 parent ff2559e commit c93df3d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
9 changes: 0 additions & 9 deletions include/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@

#include <stdbool.h>
#include <stddef.h>
#include <assert.h>

#ifdef __cplusplus
template <class Out, class In>
Out safe_cast(In in) {
assert(in);
return reinterpret_cast<Out>(in);
}
#endif

#ifdef __cplusplus
extern "C" {
Expand Down
9 changes: 9 additions & 0 deletions src/Cast.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include <assert.h>

template <class Out, class In>
Out safe_cast(In in) {
assert(in);
return reinterpret_cast<Out>(in);
}
2 changes: 1 addition & 1 deletion src/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <BWAPI/TechType.h>
#include <BWAPI/Color.h>

#include <Types.h>
#include "Cast.hpp"

namespace BWAPI {
typedef const PlayerInterface* ConstPlayer;
Expand Down

0 comments on commit c93df3d

Please sign in to comment.