Title: Build fails with CPP0X enabled. · Issue #46 · etr/libhttpserver · GitHub
Open Graph Title: Build fails with CPP0X enabled. · Issue #46 · etr/libhttpserver
X Title: Build fails with CPP0X enabled. · Issue #46 · etr/libhttpserver
Description: I just attempted to build the library with cpp0x support enabled and I encountered build errors. I have tracked down the issues and have outlined them below. First, in src/httpserver/webserver.hpp, in the #include section,
Open Graph Description: I just attempted to build the library with cpp0x support enabled and I encountered build errors. I have tracked down the issues and have outlined them below. First, in src/httpserver/webserver.hpp,...
X Description: I just attempted to build the library with cpp0x support enabled and I encountered build errors. I have tracked down the issues and have outlined them below. First, in src/httpserver/webserver.hpp,...
Opengraph URL: https://github.com/etr/libhttpserver/issues/46
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Build fails with CPP0X enabled.","articleBody":"I just attempted to build the library with cpp0x support enabled and I encountered build errors. I have tracked down the issues and have outlined them below.\n\nFirst, in `src/httpserver/webserver.hpp`, in the `#include` section, `\u003cset\u003e` is conditionally included if `CPP0X` support is not enabled (https://github.com/etr/libhttpserver/blob/master/src/httpserver/webserver.hpp#L36-40). This causes errors because `std::set` is used elsewhere throughout the code. This can be fixed by changing:\n\n```\n#ifdef USE_CPP_ZEROX\n#include \u003cunordered_set\u003e\n#else \n#include \u003cset\u003e\n#endif \n```\n\nto\n\n```\n#ifdef USE_CPP_ZEROX\n#include \u003cunordered_set\u003e\n#endif \n#include \u003cset\u003e\n```\n\nNext, when declaring the `bans` and `allowances` variables on https://github.com/etr/libhttpserver/blob/master/src/httpserver/webserver.hpp#L238-244, `std::unordered_set` is used if CPP0X support is enabled, but the type that it stores (`http::ip_representation`) does not have `std::hash` defined for it. In my opinion, unordered set may not be required here as _O(lg n)_ lookup is probably sufficient for the purposes that it serves, and the time gain that you would get with _O(1)_ lookup with unordered set likely doesn't outweigh the space overhead. \n\nNext, in `src/webserver.cpp`, there are quite a few instances where `std::make_pair` is called but the template arguments are provided; they should always be omitted with `make_pair`, and because C++0x is stricter with type conversions, they fail to compile. The offending lines are https://github.com/etr/libhttpserver/blob/master/src/webserver.cpp#L252, https://github.com/etr/libhttpserver/blob/master/src/webserver.cpp#L1417, and https://github.com/etr/libhttpserver/blob/master/src/webserver.cpp#L1428.\n\nLastly, for some reason, when running configure with CPP0X enabled, the --std=c++0x flag is missing from somewhere in the generated Makefile. To fix this I had to run the configure command as follows:\n\n```\nCXXFLAGS=--std=c++11 ../libhttpserver/configure --prefix=/usr --enable-cpp0x\n```\n\nI have no clue how the configure script works so I don't know what would have to be modified to make this work out of the box.\n","author":{"url":"https://github.com/m-renaud","@type":"Person","name":"m-renaud"},"datePublished":"2014-03-06T16:30:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/46/libhttpserver/issues/46"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6d6266b0-d539-f281-b7a5-5973e8694a29 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C6B0:B319:B803FA:F944F1:6A531AB7 |
| html-safe-nonce | ac2843d008724eb739babbf327b0fee6e29fcbe0c895bedacdb1e10164ed45bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNkIwOkIzMTk6QjgwM0ZBOkY5NDRGMTo2QTUzMUFCNyIsInZpc2l0b3JfaWQiOiI3NTMyNjA1MTg0MTQ2NjEwODcxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d69c28dc9ab532897b5a5487535d92c0b569933e74cb598dcfa27cc58debbaa5 |
| hovercard-subject-tag | issue:28892781 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/etr/libhttpserver/46/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4e3ed0655024b11dd0b6509e67d8e141b8c68d869ef43332b4a00bbea4e3c007/etr/libhttpserver/issues/46 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4e3ed0655024b11dd0b6509e67d8e141b8c68d869ef43332b4a00bbea4e3c007/etr/libhttpserver/issues/46 |
| og:image:alt | I just attempted to build the library with cpp0x support enabled and I encountered build errors. I have tracked down the issues and have outlined them below. First, in src/httpserver/webserver.hpp,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | m-renaud |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/etr/libhttpserver git https://github.com/etr/libhttpserver.git |
| octolytics-dimension-user_id | 1201536 |
| octolytics-dimension-user_login | etr |
| octolytics-dimension-repository_id | 3416891 |
| octolytics-dimension-repository_nwo | etr/libhttpserver |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3416891 |
| octolytics-dimension-repository_network_root_nwo | etr/libhttpserver |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width