python-like string indexing in C++ -


is there (possibly, using macros) way substring of string using python-like expression f(i:j)? or, more specifically, resolve i:j expression pair of indices , j? ideas?

edit: yes, need :. or ;. basically, simple function or macros can't do. want see if possible or not.

edit: basically, want see if applicable. arrays well, maybe. question more of "can turn i:j j", guess. doesn't matter these std:strings or c-strings.

i hate myself answering, ...

#include <iostream> #include <string>  #define f(x) substr(true?x, false?x)  int main () {   std::string s = "hello, world";   std::string y = s.f(1:4);   std::cout << y << "\n"; } 

warning: hiring manager. if ever discover use technique, never hire you.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -