Giter Site home page Giter Site logo

facebook / fatal Goto Github PK

View Code? Open in Web Editor NEW
997.0 85.0 154.0 2.77 MB

Fatal is a library for fast prototyping software in modern C++. It provides facilities to enhance the expressive power of C++. The library is heavily based on template meta-programming, while keeping the complexity under-the-hood.

Home Page: https://www.facebook.com/groups/libfatal/

License: Other

C++ 99.71% C 0.08% Shell 0.21%

fatal's Issues

Compile lesson failed due to some header file missed.

clang++ -o /tmp/.build/clang++/c++11/lesson/1.1-values -O0 -g -pthread -ftemplate-depth-1024 -ftemplate-backtrace-limit=0 -ferror-limit=1 -Wall -Werror -Wextra -std=c++11 -I . lesson/1.1-values.cpp
In file included from lesson/1.1-values.cpp:10:
In file included from ./fatal/lesson/driver.h:13:
In file included from ./fatal/lesson/lesson.h:13:
In file included from ./fatal/test/test.h:15:
In file included from ./fatal/test/string.h:13:
In file included from ./fatal/string/string_view.h:13:
In file included from ./fatal/math/hash.h:13:
In file included from ./fatal/math/numerics.h:18:
In file included from ./fatal/type/traits.h:17:
./fatal/type/data_member_getter.h:112:17: error: no member named 'addressof' in namespace 'std'
return std::addressof(ref(owner));
~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 errors generated.

It seems that we miss #include <memory> in /fatal/type/data_member_getter.h
#126

Construct a variant using the value

Right now, to construct a variant we need to create an empty one and them use set or emplace. Why not having a constructor that takes the value directly? We already have it for operator=:

<typename U>
  U &operator =(U const &value)

Lessons failed to compile due to type conflict in fatal/test/string.h

When I tried to compile lessons on Mac OS X with gcc-4.9. I got the following error:

$ g++-4.9 -std=c++11 -I/Users/yinghai/Code/fatal lesson/1.0-variables.cpp -o l1
In file included from /Users/yinghai/Code/fatal/fatal/test/test.h:14:0,
                 from /Users/yinghai/Code/fatal/fatal/lesson/lesson.h:13,
                 from /Users/yinghai/Code/fatal/fatal/lesson/driver.h:13,
                 from lesson/1.0-variables.cpp:10:
/Users/yinghai/Code/fatal/fatal/test/string.h:54:10: error: redefinition of 'struct fatal::detail::string_impl::parse_impl_conversion_pair<std::basic_string<char>, long long int>'
   struct parse_impl_conversion_pair<std::string, From> { \
          ^
/Users/yinghai/Code/fatal/fatal/test/string.h:73:1: note: in expansion of macro 'FATAL_IMPL_PARSE_CONVERSION_PAIR'
 FATAL_IMPL_PARSE_CONVERSION_PAIR(long long);
 ^
/Users/yinghai/Code/fatal/fatal/test/string.h:54:10: error: previous definition of 'struct fatal::detail::string_impl::parse_impl_conversion_pair<std::basic_string<char>, long long int>'
   struct parse_impl_conversion_pair<std::string, From> { \
          ^
/Users/yinghai/Code/fatal/fatal/test/string.h:67:1: note: in expansion of macro 'FATAL_IMPL_PARSE_CONVERSION_PAIR'
 FATAL_IMPL_PARSE_CONVERSION_PAIR(std::int64_t);
 ^
/Users/yinghai/Code/fatal/fatal/test/string.h:54:10: error: redefinition of 'struct fatal::detail::string_impl::parse_impl_conversion_pair<std::basic_string<char>, long long unsigned int>'
   struct parse_impl_conversion_pair<std::string, From> { \
          ^
/Users/yinghai/Code/fatal/fatal/test/string.h:74:1: note: in expansion of macro 'FATAL_IMPL_PARSE_CONVERSION_PAIR'
 FATAL_IMPL_PARSE_CONVERSION_PAIR(unsigned long long);
 ^
/Users/yinghai/Code/fatal/fatal/test/string.h:54:10: error: previous definition of 'struct fatal::detail::string_impl::parse_impl_conversion_pair<std::basic_string<char>, long long unsigned int>'
   struct parse_impl_conversion_pair<std::string, From> { \
          ^
/Users/yinghai/Code/fatal/fatal/test/string.h:71:1: note: in expansion of macro 'FATAL_IMPL_PARSE_CONVERSION_PAIR'
 FATAL_IMPL_PARSE_CONVERSION_PAIR(std::uint64_t);
 ^

The reason for that is https://github.com/facebook/fatal/blob/master/fatal/test/string.h#L73 and https://github.com/facebook/fatal/blob/master/fatal/test/string.h#L74, type long long and unsigned long long are the same as std::int64_t and std::uint64_t. Commenting out these two lines will make things work.

Facebook>Chat panel

There is a bug in facebook in chat, there is a chat panel in right side of facebook page, when there are lots of people are online and that time, if we scroll the scroll bar, then last user are not showing properly.

see the attachment..

screenshot 100

screenshot 100 _3

constant_array::data is not constexpr

constant_array::data is not constexpr

fatal/container/constant_array.h:45:54: note: non-constexpr function 'data' cannot be used in a constant expression
  static constexpr value_type const *data() { return get.data(); }
                                                     ^
fatal/type/deprecated/constant_sequence.h:658:50: note: in call to 'data()'
  static constexpr type const *z_data() { return z_array<Suffix...>::data(); }
                                                 ^

Tools: clang-v3.9.0.

Seeing this error when making a library that iterates over the types generated by Thrift static reflection.

documentation is incorrect for FATAL_STR

From FATAL_STR macro documentation

// this is equivalent to
// using hi = constant_sequence<char, 'h', 'i'>;
FATAL_STR("hi") hi;

But the macro takes the type name as the first argument and is used like FATAL(hi, "hi")

Tests build fail: fatal/test/env.h:29:10: error: no match for 'operator[]'

I have tried to build a few tests on macOS with gcc12 (C++14 and -O2, as recommended), however it fails with:

./fatal/test/env.h: In instantiation of 'void fatal::test_impl::env::parse_env(const char* const*, Map&) [with Map = std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >]':
./fatal/test/env.h:38:12:   required from 'Map fatal::test_impl::env::parse_env(const char* const*) [with Map = std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >]'
./fatal/test/driver.h:51:59:   required from here
./fatal/test/env.h:29:10: error: no match for 'operator[]' (operand types are 'std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' and '<brace-enclosed initializer list>')
   29 |       map[{*e, p}] = p + 1;
      |       ~~~^

What is going wrong?

Metashell fails on first include statement

Using this configuration I obtain:

> #include <fatal/lesson/lesson.h>                                                                                                    
In file included from <stdin>:1:
In file included from /usr/local/share/metashell/include/fatal_a341e039dc3fd99e331ca8a02e7edbc87d751cb1/fatal/lesson/lesson.h:13:
In file included from /usr/local/share/metashell/include/fatal_a341e039dc3fd99e331ca8a02e7edbc87d751cb1/fatal/test/test.h:14:
In file included from /usr/local/share/metashell/include/fatal_a341e039dc3fd99e331ca8a02e7edbc87d751cb1/fatal/test/string.h:13:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/stdexcept:39:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/string:52:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/basic_string.h:2815:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ext/string_conversions.h:43:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:120:11: fatal error: no member named 'gets' in the global namespa
ce
  using ::gets;
        ~~^
1 error generated.

builtin.h can not compile in VS2015

Sorry, it is non-sense. I withdraw this issue. (however I can not use new VS in my environment, industry is old and stable)
I got a C1001 error. can someone tells me how to avoid it?
at about #60
using __make_integer_seq = typename impl::go...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.