Skip to content

cppshizoidS/cppshizoidS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 

Repository files navigation

Typing SVG

GitHub statistic📈:

Top Langs

cppshizoidS's GitHub stats

Laguages:

C C++ C#

Skills:

Advanced:

STL Qt SFML OpenGL GLSL GLM GLFW GLEW SDL ImGUI

Intermeduate:

.Net Drogon Boost PocoLibs FTXUI Docker MySQL Postgres SQLite

Elementary:

GTK

Learning:

Rust Vulkan

Tools:

Linux Tooling

CLion Rider Visual Studio Visual Studio Code  QT Creator CMake Ninja Conan Git Fedora Windows

Contact Me☎️:

Gmail Telegram


Typing SVG

Phanatagama

Hello world:

#include <algorithm>
#include <array>
#include <iostream>

template <typename... Args> class hello_world_printer {
private:
  template <typename _Sequence_Argument>
  constexpr auto push_one(_Sequence_Argument &&arg) -> decltype(auto) {
    if constexpr (!std::is_integral_v<std::decay_t<_Sequence_Argument>>) {
      return int(arg);
    } else {
      return char(arg);
    }
  }
  std::array<char, sizeof...(Args)> arguments;

public:
  constexpr hello_world_printer(Args... args)
      : arguments({push_one(args)...}) {}
  constexpr auto get() const noexcept { return arguments; }
  template <typename _Ch, typename _Tr, typename _Tuple, std::size_t... _Is>
  static constexpr void print_impl(std::basic_ostream<_Ch, _Tr> &ostream,
                                   const _Tuple &t,
                                   std::index_sequence<_Is...>) {
    ((ostream << (_Is == 0 ? "" : ", ") << std::get<_Is>(t.get())), ...);
  }
};
template <typename _Ch, typename _Tr, typename... _Args>
constexpr std::ostream &
operator<<(std::basic_ostream<_Ch, _Tr> &ostream,
           const hello_world_printer<_Args...> &printer) {
  ostream << '(';
  hello_world_printer<_Args...>::print_impl(
      ostream, printer, std::index_sequence_for<_Args...>());
  return ostream << ')';
}
int main() {
  std::cout << hello_world_printer('H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r','l', 'd')
            << std::endl;
  return EXIT_SUCCESS;
}

Releases

No releases published

Packages

No packages published