Skip to main content
deleted 41 characters in body
Source Link
Michael M.
  • 12.1k
  • 4
  • 25
  • 41

Javascript

[
  function (){console"console.log('Line1')}",
  function (){console"console.log('Line2')}",
  function (){console"console.log('Line3')}",
  function (){console"console.log('Line4')}"
].reverse().forEach(function(e){eeval(e);})

C++11

#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    std::vector<std::function<void()>> functors;
    functors.push_back([] { std::cout << "Line1"; });
    functors.push_back([] { std::cout << "Line2"; });
    functors.push_back([] { std::cout << "Line3"; });
    functors.push_back([] { std::cout << "Line4"; });
    std::reverse(functors.begin(),functors.end());
    std::for_each (functors.begin(), functors.end(), [](std::function<void()> f) {f();});
    return 0;
}

Javascript

[
  function (){console.log('Line1')},
  function (){console.log('Line2')},
  function (){console.log('Line3')},
  function (){console.log('Line4')}
].reverse().forEach(function(e){e();})

C++11

#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    std::vector<std::function<void()>> functors;
    functors.push_back([] { std::cout << "Line1"; });
    functors.push_back([] { std::cout << "Line2"; });
    functors.push_back([] { std::cout << "Line3"; });
    functors.push_back([] { std::cout << "Line4"; });
    std::reverse(functors.begin(),functors.end());
    std::for_each (functors.begin(), functors.end(), [](std::function<void()> f) {f();});
    return 0;
}

Javascript

[
  "console.log('Line1')",
  "console.log('Line2')",
  "console.log('Line3')",
  "console.log('Line4')"
].reverse().forEach(function(e){eval(e)})

C++11

#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    std::vector<std::function<void()>> functors;
    functors.push_back([] { std::cout << "Line1"; });
    functors.push_back([] { std::cout << "Line2"; });
    functors.push_back([] { std::cout << "Line3"; });
    functors.push_back([] { std::cout << "Line4"; });
    std::reverse(functors.begin(),functors.end());
    std::for_each (functors.begin(), functors.end(), [](std::function<void()> f) {f();});
    return 0;
}
added 637 characters in body
Source Link
Michael M.
  • 12.1k
  • 4
  • 25
  • 41

Javascript

[
  function (){console.log('Line1')},
  function (){console.log('Line2')},
  function (){console.log('Line3')},
  function (){console.log('Line4')}
].reverse().forEach(function(e){e();})
[
  function (){console.log('Line1')},
  function (){console.log('Line2')},
  function (){console.log('Line3')},
  function (){console.log('Line4')}
].reverse().forEach(function(e){e();})

C++11

#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    std::vector<std::function<void()>> functors;
    functors.push_back([] { std::cout << "Line1"; });
    functors.push_back([] { std::cout << "Line2"; });
    functors.push_back([] { std::cout << "Line3"; });
    functors.push_back([] { std::cout << "Line4"; });
    std::reverse(functors.begin(),functors.end());
    std::for_each (functors.begin(), functors.end(), [](std::function<void()> f) {f();});
    return 0;
}

Javascript

[
  function (){console.log('Line1')},
  function (){console.log('Line2')},
  function (){console.log('Line3')},
  function (){console.log('Line4')}
].reverse().forEach(function(e){e();})

Javascript

[
  function (){console.log('Line1')},
  function (){console.log('Line2')},
  function (){console.log('Line3')},
  function (){console.log('Line4')}
].reverse().forEach(function(e){e();})

C++11

#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    std::vector<std::function<void()>> functors;
    functors.push_back([] { std::cout << "Line1"; });
    functors.push_back([] { std::cout << "Line2"; });
    functors.push_back([] { std::cout << "Line3"; });
    functors.push_back([] { std::cout << "Line4"; });
    std::reverse(functors.begin(),functors.end());
    std::for_each (functors.begin(), functors.end(), [](std::function<void()> f) {f();});
    return 0;
}
Source Link
Michael M.
  • 12.1k
  • 4
  • 25
  • 41

Javascript

[
  function (){console.log('Line1')},
  function (){console.log('Line2')},
  function (){console.log('Line3')},
  function (){console.log('Line4')}
].reverse().forEach(function(e){e();})