p-ranav / tabulate Goto Github PK
View Code? Open in Web Editor NEWTable Maker for Modern C++
License: MIT License
Table Maker for Modern C++
License: MIT License
I see in the examples you are hard coding the number of columns, it would be nice to make this dynamic.
The following issue occurs where tabulate will override the flags of an iostream and fail to undo the changes after the print. This causes any future prints to have the flags of tabulate.
The issue comes from these locale lines:
std::locale::global(std::locale(locale));
This overrides the global setting for all stringstreams and causes other prints to be affected.
https://stackoverflow.com/questions/17202819/c-reset-locale-to-c-globally
Hi guys, thanks for sharing this project. I'm now practicing c++ with new features, and it seems that I can learn much from this project. However, as a tabulation tool, it would be great if it can support interactive drawing, like CLING. If it is possible to add this feature in future? #
I'm using the latest C++ language and tried many different linker configurations to get rid of the errors below. I can't seem to get the example program to build:
c:\users\bountyhunter\code\open_netbattle_api\client\extern\tabulate\include\tabulate\format.hpp(715): error C2672: 'std::isspace': no matching overloaded function found
c:\users\bountyhunter\code\open_netbattle_api\client\extern\tabulate\include\tabulate\format.hpp(715): error C2780: 'bool std::isspace(_Elem,const std::locale &)': expects 2 arguments - 1 provided
c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\locale(253): note: see declaration of 'std::isspace'
c:\users\bountyhunter\code\open_netbattle_api\client\extern\tabulate\include\tabulate\format.hpp(723): error C2672: 'std::isspace': no matching overloaded function found
c:\users\bountyhunter\code\open_netbattle_api\client\extern\tabulate\include\tabulate\format.hpp(723): error C2780: 'bool std::isspace(_Elem,const std::locale &)': expects 2 arguments - 1 provided
c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\locale(253): note: see declaration of 'std::isspace'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(103): warning C4005: 'AF_IPX': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(457): note: see previous definition of 'AF_IPX'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(147): warning C4005: 'AF_MAX': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(476): note: see previous definition of 'AF_MAX'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(185): warning C4005: 'SO_DONTLINGER': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(399): note: see previous definition of 'SO_DONTLINGER'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(235): error C2011: 'sockaddr': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(1007): note: see declaration of 'sockaddr'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(437): error C2059: syntax error: 'constant'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(437): error C3805: 'constant': unexpected token, expected either '}' or a ','
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(572): warning C4005: 'IN_CLASSA': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(284): note: see previous definition of 'IN_CLASSA'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(578): warning C4005: 'IN_CLASSB': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(290): note: see previous definition of 'IN_CLASSB'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(584): warning C4005: 'IN_CLASSC': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(296): note: see previous definition of 'IN_CLASSC'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(595): warning C4005: 'INADDR_ANY': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(301): note: see previous definition of 'INADDR_ANY'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(597): warning C4005: 'INADDR_BROADCAST': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(303): note: see previous definition of 'INADDR_BROADCAST'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h(633): error C2011: 'sockaddr_in': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(1011): note: see declaration of 'sockaddr_in'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(136): error C2011: 'fd_set': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(1019): note: see declaration of 'fd_set'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(156): warning C4005: 'FD_CLR': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(94): note: see previous definition of 'FD_CLR'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(171): warning C4005: 'FD_SET': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(99): note: see previous definition of 'FD_SET'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(180): error C2011: 'timeval': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(1035): note: see declaration of 'timeval'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(236): error C2011: 'hostent': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(1023): note: see declaration of 'hostent'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(249): error C2011: 'netent': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(177): note: see declaration of 'netent'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(256): error C2011: 'servent': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(1027): note: see declaration of 'servent'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(268): error C2011: 'protoent': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(1031): note: see declaration of 'protoent'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(364): error C2011: 'WSAData': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(319): note: see declaration of 'WSAData'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(462): error C2011: 'sockproto': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(491): note: see declaration of 'sockproto'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(504): error C2011: 'linger': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(1015): note: see declaration of 'linger'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(517): warning C4005: 'SOMAXCONN': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(541): note: see previous definition of 'SOMAXCONN'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(552): warning C4005: 'FD_READ': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(559): note: see previous definition of 'FD_READ'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(555): warning C4005: 'FD_WRITE': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(560): note: see previous definition of 'FD_WRITE'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(558): warning C4005: 'FD_OOB': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(561): note: see previous definition of 'FD_OOB'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(561): warning C4005: 'FD_ACCEPT': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(562): note: see previous definition of 'FD_ACCEPT'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(564): warning C4005: 'FD_CONNECT': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(563): note: see previous definition of 'FD_CONNECT'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(567): warning C4005: 'FD_CLOSE': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(564): note: see previous definition of 'FD_CLOSE'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1625): error C2375: 'accept': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(739): note: see declaration of 'accept'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1647): error C2375: 'bind': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(744): note: see declaration of 'bind'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1668): error C2375: 'closesocket': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(749): note: see declaration of 'closesocket'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1685): error C2375: 'connect': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(751): note: see declaration of 'connect'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1706): error C2375: 'ioctlsocket': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(756): note: see declaration of 'ioctlsocket'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1729): error C2375: 'getpeername': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(761): note: see declaration of 'getpeername'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1750): error C2375: 'getsockname': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(766): note: see declaration of 'getsockname'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1771): error C2375: 'getsockopt': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(771): note: see declaration of 'getsockopt'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1796): error C2375: 'htonl': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(778): note: see declaration of 'htonl'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1813): error C2375: 'htons': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(780): note: see declaration of 'htons'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1831): error C2375: 'inet_addr': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(782): note: see declaration of 'inet_addr'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1849): error C2375: 'inet_ntoa': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(784): note: see declaration of 'inet_ntoa'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1949): error C2375: 'listen': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(786): note: see declaration of 'listen'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1968): error C2375: 'ntohl': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(790): note: see declaration of 'ntohl'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(1985): error C2375: 'ntohs': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(792): note: see declaration of 'ntohs'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2002): error C2375: 'recv': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(794): note: see declaration of 'recv'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2025): error C2375: 'recvfrom': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(800): note: see declaration of 'recvfrom'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2052): error C2375: 'select': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(808): note: see declaration of 'select'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2077): error C2375: 'send': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(815): note: see declaration of 'send'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2100): error C2375: 'sendto': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(821): note: see declaration of 'sendto'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2127): error C2375: 'setsockopt': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(829): note: see declaration of 'setsockopt'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2152): error C2375: 'shutdown': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(836): note: see declaration of 'shutdown'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2172): error C2375: 'socket': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(840): note: see declaration of 'socket'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2197): error C2375: 'gethostbyaddr': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(847): note: see declaration of 'gethostbyaddr'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2219): error C2375: 'gethostbyname': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(852): note: see declaration of 'gethostbyname'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2236): error C2375: 'gethostname': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(854): note: see declaration of 'gethostname'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2276): error C2375: 'getservbyport': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(858): note: see declaration of 'getservbyport'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2295): error C2375: 'getservbyname': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(862): note: see declaration of 'getservbyname'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2314): error C2375: 'getprotobynumber': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(866): note: see declaration of 'getprotobynumber'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2331): error C2375: 'getprotobyname': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(868): note: see declaration of 'getprotobyname'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2351): error C2375: 'WSAStartup': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(872): note: see declaration of 'WSAStartup'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2371): error C2375: 'WSACleanup': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(876): note: see declaration of 'WSACleanup'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2388): error C2375: 'WSASetLastError': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(878): note: see declaration of 'WSASetLastError'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2405): error C2375: 'WSAGetLastError': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(880): note: see declaration of 'WSAGetLastError'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2426): error C2375: 'WSAIsBlocking': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(882): note: see declaration of 'WSAIsBlocking'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2444): error C2375: 'WSAUnhookBlockingHook': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(884): note: see declaration of 'WSAUnhookBlockingHook'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2462): error C2375: 'WSASetBlockingHook': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(886): note: see declaration of 'WSASetBlockingHook'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2480): error C2375: 'WSACancelBlockingCall': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(888): note: see declaration of 'WSACancelBlockingCall'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2498): error C2375: 'WSAAsyncGetServByName': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(890): note: see declaration of 'WSAAsyncGetServByName'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2526): error C2375: 'WSAAsyncGetServByPort': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(898): note: see declaration of 'WSAAsyncGetServByPort'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2554): error C2375: 'WSAAsyncGetProtoByName': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(906): note: see declaration of 'WSAAsyncGetProtoByName'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2580): error C2375: 'WSAAsyncGetProtoByNumber': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(913): note: see declaration of 'WSAAsyncGetProtoByNumber'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2606): error C2375: 'WSAAsyncGetHostByName': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(920): note: see declaration of 'WSAAsyncGetHostByName'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2632): error C2375: 'WSAAsyncGetHostByAddr': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(927): note: see declaration of 'WSAAsyncGetHostByAddr'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2662): error C2375: 'WSACancelAsyncRequest': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(936): note: see declaration of 'WSACancelAsyncRequest'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h(2680): error C2375: 'WSAAsyncSelect': redefinition; different linkage
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(938): note: see declaration of 'WSAAsyncSelect'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(80): error C2079: 'sockaddr_gen::Address' uses undefined struct 'sockaddr'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(81): error C2079: 'sockaddr_gen::AddressIn' uses undefined struct 'sockaddr_in'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(135): warning C4005: 'IP_TOS': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(349): note: see previous definition of 'IP_TOS'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(136): warning C4005: 'IP_TTL': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(348): note: see previous definition of 'IP_TTL'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(137): warning C4005: 'IP_MULTICAST_IF': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(343): note: see previous definition of 'IP_MULTICAST_IF'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(138): warning C4005: 'IP_MULTICAST_TTL': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(344): note: see previous definition of 'IP_MULTICAST_TTL'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(139): warning C4005: 'IP_MULTICAST_LOOP': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(345): note: see previous definition of 'IP_MULTICAST_LOOP'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(140): warning C4005: 'IP_ADD_MEMBERSHIP': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(346): note: see previous definition of 'IP_ADD_MEMBERSHIP'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(141): warning C4005: 'IP_DROP_MEMBERSHIP': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(347): note: see previous definition of 'IP_DROP_MEMBERSHIP'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(142): warning C4005: 'IP_DONTFRAGMENT': macro redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(350): note: see previous definition of 'IP_DONTFRAGMENT'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(222): error C2079: '_SOCKADDR_INET::Ipv4' uses undefined struct 'sockaddr_in'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2ipdef.h(738): error C2011: 'ip_mreq': 'struct' type redefinition
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock.h(360): note: see declaration of 'ip_mreq'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\ws2tcpip.h(744): error C2065: 'WSASetLastError': undeclared identifier
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\ws2tcpip.h(751): error C2065: 'WSASetLastError': undeclared identifier
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\ws2tcpip.h(790): error C2065: 'WSASetLastError': undeclared identifier
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\ws2tcpip.h(797): error C2065: 'WSASetLastError': undeclared identifier
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\ws2tcpip.h(841): error C2065: 'WSASetLastError': undeclared identifier
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\ws2tcpip.h(848): error C2065: 'WSASetLastError': undeclared identifier
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\ws2tcpip.h(889): error C2065: 'WSASetLastError': undeclared identifier
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\ws2tcpip.h(896): error C2065: 'WSASetLastError': undeclared identifier
I have a 1000 rows table.
It would be convenient to break it into say 4 parts ( pages ) of 250 rows each for printing purposes.
There is the cmake option tabulate_BUILD_TESTS
but it isn't clear how to run tests.
It's best to have a test
target so that tests could be easily run.
termcolor::colorize
does not play nicely with std::stringstream
and has unintended side effects.
Hello, what am I doing wrong? The special characters, emoji and table graph are incorrect
picture:
https://i.imgur.com/f0Fj1Fe.png
the github link isn't underlined or in italic either.
Usual visual studio 16.0.29709
ps. is there a single header available?
Example usage:
table.column(0).format()
.font_color_predicate([](std::string_view cell) {
if (cell == "WARNING") return Color::yellow;
else if (cell == "ERROR") return Color::red;
else return Color::white;
});
applies font color using a predicate function applied on the cell contents for each cell in that column.
When showing multiple tables it would be nice to see a table name at the top of the table, e.g. in the upper border. At the moment I embed the table in an outer table and put a string as first row as the title. But then you handle with 2 tables.
+---------+------------+-----------+-------------+
| | | | |
| Emp. ID | First Name | Last Name | Department |
| | | | |
+-------+----------+---------+-----------+
|101 |Donald |Patrick |Finance |
+-------+----------+---------+-----------+
|102 |Donald |Patrick |Marketing |
+-------+----------+---------+-----------+
|103 |Ian |Jacob |Engineering|
+-------+----------+---------+-----------+
Hey just want to know is there any facility to pass an array or vector to table.add_row() so that required row is generated from arrray/vector itself?
I have some troubles when we hide the left border with a table composed of several lines. With this code :
Table table;
table.add_row({"key","value1\nvalue2"});
table[0][0].format().hide_border_left();
Table table2;
table2.add_row({table});
std::cout << "first table :\n" << table << std::endl;
std::cout << "second table :\n" << table2 << std::endl;
My result is :
first table :
+-----+--------+
key | value1 |
| value2 |
+-----+--------+
second table :
+------------------+
| +-----+--------+ |
| key | value1 | |
| | value2 | |
| +-----+--------+ |
+------------------+
any hints or it’s an issue?
Description
When running the summary.exe
sample on Windows 10 in Debug, an assertion is triggered due to a string subscript being out of range. It happens on line 165 of row.hpp
:
if (word_wrapped_text[word_wrapped_text.size() - 1] != '\n')
estimated_row_height += 1;
There is no check for word_wrapped_text.empty()
. If the size of the string is 0, then the program crashes.
Platform
OS: Windows 10
IDE: Visual Studio Code
Compiler: VS 2019 x64, Debug build
Hey @p-ranav, I'd like to use the shape
tuple that's implemented in the master branch.
I'm one of the maintainers of the conda package and ideally it depends on your git releases to have a conda package release.
Do you have any plans for making a new release?
Thanks a lot =)
Hey @p-ranav I know I just asked for a new release, but it was before I realized I had to make those changes for tabulate to work in OSX.
Is it possible to make a new release for now for conda forge grab it automatically?
Thanks a lot!
Dear Contributors,
Thanks for your useful library, I am trying to use this table objects in real-time terminal application and show the columns contents dynamically, when they changed, for example during the execution the contents of tables needs to change (like top command it refreshed the generated output), is it possible to do it ?
Thanks :)
tabulate
uses wcswidth
to compute the display width for multi-byte characterstabulate
computes the number of multi-byte characters correctly but this is not the same as the "display width", i.e., number of columns to be occupied by the cell contents.termcolor::colorize
doesn't seem to work well with std::stringstream
. Using this has unintended effects when printing newlines.
I'm trying to print tables without any border characters. When I use the .format().border_top(" ")
etc type of commands, it has no effect and always prints the default +----+ type borders. Similarly using output_table.format().hide_border();
also has no effect, and still prints with the default borders. Am I using this wrong or is it a bug?
Hi,
First, wonderful library !
Found out that tabulate code generates some warning when compield with -Wall.
tabulate-src/include/tabulate/table_internal.hpp: In static member function ‘static void tabulate::Printer::print_table(std::ostream&, tabulate::TableInternal&)’:
tabulate-src/include/tabulate/table_internal.hpp:218:14: warning: unused variable ‘column_width’ [-Wunused-variable]
218 | auto column_width = column_widths[j];
| ^~~~~~~~~~~~
tabulate-src/include/tabulate/table_internal.hpp: In static member function ‘static void tabulate::Printer::print_row_in_cell(std::ostream&, tabulate::TableInternal&, const std::pair<long unsigned int, long unsigned int>&, const std::pair<long unsigned int, long unsigned int>&, size_t, size_t)’:
tabulate-src/include/tabulate/table_internal.hpp:244:8: warning: unused variable ‘row_height’ [-Wunused-variable]
244 | auto row_height = dimension.first;
| ^~~~~~~~~~
tabulate-src/include/tabulate/table_internal.hpp:256:8: warning: unused variable ‘padding_bottom’ [-Wunused-variable]
256 | auto padding_bottom = format.padding_bottom_.value();
| ^~~~~~~~~~~~~~
Nothing very drastic but it could be cool if the library could compile warning free with -Wall.
Best regards
how about asciidoc export?
The table format is quite powerful
For example, see here https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#tables and here https://www.methods.co.nz/asciidoc/chunked/ch23.html
Added tests for format inheritance
Hey @p-ranav, would be nice to have a new version of tabulate
on conda :)
I can of course create the new version on conda, but for that I need a new tagged version on github.
Lemme know if you want any help to get this going.
Thanks!
Modern C++ is C++17 however on the internet "modern" is synonymous with C++11 at minimum. I didn't see any notes anywhere trying to compile but #include <variant>
and #include <optional>
gave it away...
On that same note, my mingw tools for gcc on windows have the std::optional utility under experimental/*
.
I don't think there's a substitute for variant under experimental but a way to be able to swap it out (and optional too) for a custom structures could be achieved for those < C++17. Variants and optional are very simple structures. They're not fundamentally difficult to write and would open the lib up to C++14 at least.
Director column is not centered.
Looks like setting .font_style({tabulate::FontStyle::bold})
don't affect border nor corner.
Is it intended?
Hey I do not get the meaning of this in quick start. I have g++ compiler. Can you please explain to me how can I utilize your wonderful work in my program?
It seems that this is fixed in master, but the last release includes <optional>
unconditionally while you already provide a polyfill in the source code.
It may be useful to add a basic cmake version file with e.g. write_basic_package_version_file
, so that we can do e.g.
find_package(tabulate 1.3 REQUIRED)
in downstream projects.
So I've just recently tried out this library today. Pretty good overall =)
Fairly surprised that there was no way to query the number of rows/columns/cells in a table.
Formatting the last row of a table, I tried a size()
or a end()-1
function, like you would see in a standard container.
Frustrating to have to treat a class like a C array, with external variables to keep track of.
Would be good to have a shape()
function for the row/column count.
Second, I didn't realise that a variable cell count for each row doesn't work. Something like:
table.add_row("Title").add_row("Key", "Value")
There was no indication that something was wrong until a very generic 'vector subscript out of range' assert triggered.
An assert (for example) within add_row(...)
would help prevent a waste of time in the future..
When I try to put a Table
with a colored cell into another Table
the color is not working anymore.
Here is an example:
#include "tabulate/tabulate.hpp"
#include <iostream>
int main()
{
using namespace tabulate;
Table inner;
inner.add_row({"A"});
inner[0][0].format().font_color(Color::green);
std::cout << "Here 'A' is green:\n" << inner << std::endl;
Table outer;
outer.add_row({inner});
std::cout << "Here 'A' is not green:\n" << outer << std::endl;
return 0;
}
which gives the following output on Ubuntu:
Here 'A' is green:
+---+
| A |
+---+
Here 'A' is not green:
+-------+
| +---+ |
| | A | |
| +---+ |
+-------+
Is there a possibility to update the table via adding new rows and flushing them to the standard output during runtime?
The idea is:
I checked the issue #53, but it's not actually what i am looking for.
Use Tabulate in two different .cpp and link the result leads to multiple definition errors.
I think most of the functions in the header shoudl be marked inline.
The command:
message(STATUS "${tabulate_VERSION}")
Returns empty.
I can fix it in a PR!
Is there a way to suppress inner row and/or column borders in a table?
+--+--+
| A | B |
+--+--+
| 1 | 2 |
| 3 | 4 |
+--+--+
Hi,
it would be idiomatic to add clear() method.
Implementation would be trivial, unless std::shared_ptr<TableInternal> table_;
field is kept somewhere else (it is?).
First, we are super grateful for this package which is super nice!
FYI, it seems that this change is backward incompatible because of the change in the signature.
Maybe this should have been a 2.0 change?
Ping @marimeireles
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.