Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
fix: Résolution problème templates non définis
Browse files Browse the repository at this point in the history
TPP : CPP/HPP mais pour template
  • Loading branch information
RomainTHD committed Oct 5, 2020
1 parent c706c56 commit e1adc5b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
2 changes: 2 additions & 0 deletions include/std/io/printText.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,6 @@ namespace std::io {
void printHex(T value, _In_ const char* end = "\n", uint8_t color = BG_DEFAULT | FG_DEFAULT);
}

#include "printText.tpp"

#endif //ROMAINOS_PRINTTEXT_HPP
24 changes: 24 additions & 0 deletions include/std/io/printText.tpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Created by Romain on 05/10/2020.

#ifndef ROMAINOS_PRINTTEXT_TPP
#define ROMAINOS_PRINTTEXT_TPP

namespace std::io {
template <typename T>
void printInt(T value, _In_ const char* end, uint8_t color) {
printString(intToString(value), end, color);
}

template <typename T>
void printFloat(T value, _In_ const char* end, u8 decimalPlaces, uint8_t color) {
printString(floatToString(value, decimalPlaces), end, color);
}

template <typename T>
void printHex(T value, _In_ const char* end, uint8_t color) {
printString(hexToString(value), end, color);
}
}

#endif //ROMAINOS_PRINTTEXT_TPP
2 changes: 2 additions & 0 deletions include/std/stack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,6 @@ class Stack {
size_t _length;
};

#include "stack.tpp"

#endif //ROMAINOS_STACK_HPP
7 changes: 5 additions & 2 deletions src/std/stack.cpp → include/std/stack.tpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Created by Romain on 11/09/2020.
// Created by Romain on 05/10/2020.

#include <stack.hpp>
#ifndef ROMAINOS_STACK_TPP
#define ROMAINOS_STACK_TPP

template<typename T>
Stack<T>::Stack() : _first(nullptr), _length(0) {}
Expand Down Expand Up @@ -68,3 +69,5 @@ Stack<T>::StackElem::StackElem(T elem) : value(elem), next(nullptr) {}

template<typename T>
Stack<T>::StackElem::~StackElem() = default;

#endif //ROMAINOS_STACK_TPP
21 changes: 0 additions & 21 deletions src/std/io/printText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,4 @@ namespace std::io {
printChar(' ', color);
} while (getCursorPosition() != 0);
}

template <typename T>
void printInt(T value, _In_ const char* end, uint8_t color) {
printString(intToString(value), end, color);
}

template <typename T>
void printFloat(T value, _In_ const char* end, u8 decimalPlaces, uint8_t color) {
printString(floatToString(value, decimalPlaces), end, color);
}

template <typename T>
void printHex(T value, _In_ const char* end, uint8_t color) {
printString(hexToString(value), end, color);
}

template void printInt(int value, _In_ const char* end, uint8_t color);
template void printInt(u32 value, _In_ const char* end, uint8_t color);
template void printInt(u64 value, _In_ const char* end, uint8_t color);

template void printHex(u32 value, _In_ const char* end, uint8_t color);
}

0 comments on commit e1adc5b

Please sign in to comment.