You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2021/02/02 13:18:28 UTC

[GitHub] [incubator-brpc] muween opened a new issue #1340: flat_map支持struct作key吗?

muween opened a new issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340


   同样的struct,使用std::map通过,而使用butil::FlatMap出现场错误,大致为
   `struct xxx is used but never defined [-fpermissive]`


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] serverglen edited a comment on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
serverglen edited a comment on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-772182688


   `struct xxx {
   };`
   
   需要实现:
   1. 重载==运算符
   `
   bool operator==(const struct xxx& obj) const {
       // TODO
   }
   `
   2. 实现自定义的hash函数
   
   `
   template <>
   struct butil::DefaultHasher <struct xxx> {
       std::size_t operator() (const struct xxx& obj) {
           // TODO
       }
   };
   `


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] serverglen commented on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
serverglen commented on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-772182688


   struct xxx {
   };
   
   需要实现:
   1. 重载==运算符
   bool operator==(const struct xxx& obj) const {
       // TODO
   }
   
   2. 实现自定义的hash函数
   template <>
   struct butil::DefaultHasher<struct xxx> {
        // TODO
   };


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] serverglen commented on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
serverglen commented on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-772176824


   应该是支持的,需要自己实现一个hash函数


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] serverglen edited a comment on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
serverglen edited a comment on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-772182688


   struct xxx {
   };
   
   需要实现:
   1. 重载==运算符
   `
   bool operator==(const struct xxx& obj) const {
       // TODO
   }
   `
   2. 实现自定义的hash函数
   
   `
   template <>
   struct butil::DefaultHasher <struct xxx> {
       std::size_t operator() (const struct xxx& obj) {
           // TODO
       }
   };
   `


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] serverglen edited a comment on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
serverglen edited a comment on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-772182688


   struct xxx {
   };
   
   需要实现:
   1. 重载==运算符
   bool operator==(const struct xxx& obj) const {
       // TODO
   }
   
   2. 实现自定义的hash函数
   template <>
   struct butil::DefaultHasher<struct xxx> {
       std::size_t operator() (const struct xxx& obj) {
           // TODO
       }
   };


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] serverglen edited a comment on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
serverglen edited a comment on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-772182688


   struct xxx {
   };
   
   需要实现:
   1. 重载==运算符
   bool operator==(const struct xxx& obj) const {
       // TODO
   }
   
   2. 实现自定义的hash函数
   template <>
   struct butil::DefaultHasher
   <struct xxx> {
       std::size_t operator() (const struct xxx& obj) {
           // TODO
       }
   };


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] serverglen edited a comment on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
serverglen edited a comment on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-772182688


   struct xxx {
   };
   
   需要实现:
   1. 重载==运算符
   bool operator==(const struct xxx& obj) const {
       // TODO
   }
   
   2. 实现自定义的hash函数
   template <>
   struct butil::DefaultHasher <struct xxx> {
       std::size_t operator() (const struct xxx& obj) {
           // TODO
       }
   };
   
   template <>
   struct butil::DefaultHasher <struct xxx> {
       std::size_t operator() (const struct xxx& obj) {
           // TODO
       }
   };


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] serverglen removed a comment on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
serverglen removed a comment on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-772176824


   应该是支持的,需要自己实现一个hash函数


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] serverglen edited a comment on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
serverglen edited a comment on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-772182688






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] serverglen edited a comment on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
serverglen edited a comment on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-772182688


   struct xxx {
   };
   
   需要实现:
   1. 重载==运算符
   bool operator==(const struct xxx& obj) const {
       // TODO
   }
   
   2. 实现自定义的hash函数
   template <>
   struct butil::DefaultHasher <struct xxx> {
       std::size_t operator() (const struct xxx& obj) {
           // TODO
       }
   };


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] lorinlee commented on issue #1340: flat_map支持struct作key吗?

Posted by GitBox <gi...@apache.org>.
lorinlee commented on issue #1340:
URL: https://github.com/apache/incubator-brpc/issues/1340#issuecomment-782064848


   @muween 可以贴个代码片段吗,以及编译器报的错误


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org