char *ft_strtrim(char const *s) { unsigned int i; int count; char *dst; unsigned int size; if (s && *s != '\0') { count = count_blank(s); size = ft_strlen(s); if (count == (int)size) return (""); if ((dst = (char*)malloc(sizeof(char) * (size - count + 1))) == NULL) return (NULL); i = first_pos(s); size = size - count + first_pos(s); while (i < size) { dst[i - first_pos(s)] = s[i]; i++; } dst[i - first_pos(s)] = '\0'; return (dst); } return (""); }
T pop() { if (empty()) throw std::runtime_error("empty buffer"); auto pos = first_pos(); size_--; return data_[pos]; }
void unit_center(void) { igreboard_get_color_switch(&igreboard_device, &is_red); first_pos(); goto_first_line(); aversive_goto_xy_abs(&aversive_device, 3000 / 2, 2100 / 2); wait_done(); }
const_iterator begin() const { return const_iterator(*this, first_pos(), empty()); }