szaszm commented on a change in pull request #839: URL: https://github.com/apache/nifi-minifi-cpp/pull/839#discussion_r492150716
########## File path: libminifi/include/utils/FlatMap.h ########## @@ -0,0 +1,211 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LIBMINIFI_INCLUDE_UTILS_FLATMAP_H_ +#define LIBMINIFI_INCLUDE_UTILS_FLATMAP_H_ + +#include <tuple> +#include <functional> +#include <vector> +#include <utility> + +namespace org { +namespace apache { +namespace nifi { +namespace minifi { +namespace utils { + +template<typename K, typename V> +class FlatMap{ + public: + using value_type = std::pair<K, V>; Review comment: My point is that if you write a container, then it should behave like a canonical container so that it can work as a drop-in replacement for at least some containers. Named requirements (i.e. concepts) just clarify the properties of a canonical container so that implementors have guidelines to follow and users have an interface to code against. They are just the generic programming equivalent of an interface, with less dependencies and less opportunity for the compiler to check whether the requirements are satisfied. You can not implement `java.util.Collection` without implementing `isEmpty`, but the compiler can not yet enforce that your Collection implementation has `empty`. I think the closer the satisfied concepts are to the reality, the better. Ideally, this would satisfy AssociativeContainer and iterators would satisfy RandomAccessIterator, but I'm OK with postponing the implementation of stricter requirements until they are actually needed. ---------------------------------------------------------------- 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: [email protected]
