summaryrefslogtreecommitdiff
path: root/src/core/smallmap_type.hpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-12-20 17:57:56 +0000
committertruebrain <truebrain@openttd.org>2011-12-20 17:57:56 +0000
commit1c9bec19993417b1f3b240f2bdb0745aa26c0cb3 (patch)
treed09407cc962ee87ac1bbbbc60951cad74c6b1db7 /src/core/smallmap_type.hpp
parent7a38642a1c83531a65907ae784bc03a82d35132a (diff)
downloadopenttd-1c9bec19993417b1f3b240f2bdb0745aa26c0cb3.tar.xz
(svn r23640) -Fix: stop using FORCEINLINE (1/3rd of the instances were, the others were still regular inline), but make sure inline is always a 'forced' inline (I am looking at you MSVC)
Diffstat (limited to 'src/core/smallmap_type.hpp')
-rw-r--r--src/core/smallmap_type.hpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/core/smallmap_type.hpp b/src/core/smallmap_type.hpp
index f72a8800d..57373c442 100644
--- a/src/core/smallmap_type.hpp
+++ b/src/core/smallmap_type.hpp
@@ -26,7 +26,7 @@ struct SmallPair {
U second;
/** Initializes this Pair with data */
- FORCEINLINE SmallPair(const T &first, const U &second) : first(first), second(second) { }
+ inline SmallPair(const T &first, const U &second) : first(first), second(second) { }
};
/**
@@ -45,16 +45,16 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
typedef const Pair *const_iterator;
/** Creates new SmallMap. Data are initialized in SmallVector constructor */
- FORCEINLINE SmallMap() { }
+ inline SmallMap() { }
/** Data are freed in SmallVector destructor */
- FORCEINLINE ~SmallMap() { }
+ inline ~SmallMap() { }
/**
* Finds given key in this map
* @param key key to find
* @return &Pair(key, data) if found, this->End() if not
*/
- FORCEINLINE Pair *Find(const T &key)
+ inline Pair *Find(const T &key)
{
for (uint i = 0; i < this->items; i++) {
if (key == this->data[i].first) return &this->data[i];
@@ -67,7 +67,7 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
* @param key key to test
* @return true iff the item is present
*/
- FORCEINLINE bool Contains(const T &key)
+ inline bool Contains(const T &key)
{
return this->Find(key) != this->End();
}
@@ -77,7 +77,7 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
* @param pair pair to remove
* @note it has to be pointer to pair in this map. It is overwritten by the last item.
*/
- FORCEINLINE void Erase(Pair *pair)
+ inline void Erase(Pair *pair)
{
assert(pair >= this->Begin() && pair < this->End());
*pair = this->data[--this->items];
@@ -89,7 +89,7 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
* @return true iff the key was found
* @note last item is moved to its place, so don't increase your iterator if true is returned!
*/
- FORCEINLINE bool Erase(const T &key)
+ inline bool Erase(const T &key)
{
for (uint i = 0; i < this->items; i++) {
if (key == this->data[i].first) {
@@ -106,7 +106,7 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
* @param data data
* @return true iff the key wasn't already present
*/
- FORCEINLINE bool Insert(const T &key, const U &data)
+ inline bool Insert(const T &key, const U &data)
{
if (this->Contains(key)) return false;
Pair *n = this->Append();
@@ -121,7 +121,7 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
* @return data belonging to this key
* @note if this key wasn't present, new entry is created
*/
- FORCEINLINE U &operator[](const T &key)
+ inline U &operator[](const T &key)
{
for (uint i = 0; i < this->items; i++) {
if (key == this->data[i].first) return this->data[i].second;
@@ -131,7 +131,7 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
return n->second;
}
- FORCEINLINE void SortByKey()
+ inline void SortByKey()
{
QSortT(this->Begin(), this->items, KeySorter);
}