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 28, 2017
1 parent 10a4f74 commit eca704c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 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);
}
1 change: 1 addition & 0 deletions src/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "UpgradeType.hpp"
#include "WeaponType.hpp"
#include "IteratorImpl.hpp"
#include "Cast.hpp"

namespace BWAPI {
typedef const PlayerInterface* ConstPlayer;
Expand Down

0 comments on commit eca704c

Please sign in to comment.